From 601dd5bad9953215fa1bde72a2193ffbb1c190c3 Mon Sep 17 00:00:00 2001 From: Ryan Vickramasinghe Date: Fri, 20 Nov 2026 04:42:55 +0000 Subject: [PATCH] GH-55571: [C++][Parquet] Honor configured column encoding on dictionary fallback --- .../parquet/arrow/arrow_reader_writer_test.cc | 60 ++++++ cpp/src/parquet/column_writer.cc | 96 +++++---- cpp/src/parquet/column_writer_test.cc | 184 ++++++++++++++++++ cpp/src/parquet/properties.h | 12 +- 4 files changed, 304 insertions(+), 48 deletions(-) diff --git a/cpp/src/parquet/arrow/arrow_reader_writer_test.cc b/cpp/src/parquet/arrow/arrow_reader_writer_test.cc index 6df48ff19a4..d67f83729c0 100644 --- a/cpp/src/parquet/arrow/arrow_reader_writer_test.cc +++ b/cpp/src/parquet/arrow/arrow_reader_writer_test.cc @@ -5348,6 +5348,66 @@ TEST_P(TestArrowWriteDictionary, NestedDictionaryParentNullStatistics) { } } +TEST_P(TestArrowWriteDictionary, FallbackUsesConfiguredEncoding) { + ASSERT_OK_AND_ASSIGN(auto chunk0, ::arrow::DictionaryArray::FromArrays( + ArrayFromJSON(::arrow::int32(), "[0, 1, 0, 1]"), + ArrayFromJSON(::arrow::utf8(), R"(["a", "b"])"))); + ASSERT_OK_AND_ASSIGN(auto chunk1, ::arrow::DictionaryArray::FromArrays( + ArrayFromJSON(::arrow::int32(), "[0, 1, 0, 1]"), + ArrayFromJSON(::arrow::utf8(), R"(["c", "d"])"))); + + auto schema = ::arrow::schema({::arrow::field("values", chunk0->type())}); + auto chunked = std::make_shared(::arrow::ArrayVector{chunk0, chunk1}); + auto table = ::arrow::Table::Make(schema, {chunked}); + + auto sink = CreateOutputStream(); + auto writer_properties = WriterProperties::Builder() + .version(ParquetVersion::PARQUET_2_6) + ->data_page_version(this->GetParquetDataPageVersion()) + ->enable_dictionary() + ->encoding("values", Encoding::DELTA_LENGTH_BYTE_ARRAY) + ->build(); + ASSERT_OK_AND_ASSIGN( + auto writer, + FileWriter::Open(*schema, ::arrow::default_memory_pool(), sink, writer_properties, + default_arrow_writer_properties())); + ASSERT_OK(writer->WriteTable(*table, std::numeric_limits::max())); + ASSERT_OK(writer->Close()); + ASSERT_OK_AND_ASSIGN(auto buffer, sink->Finish()); + + auto parquet_reader = ParquetFileReader::Open(std::make_shared(buffer)); + auto col_meta = parquet_reader->metadata()->RowGroup(0)->ColumnChunk(0); + int32_t dict_pages = 0; + int32_t rle_dict_pages = 0; + int32_t dlba_pages = 0; + int32_t plain_data_pages = 0; + for (const auto& stat : col_meta->encoding_stats()) { + if (stat.page_type == PageType::DICTIONARY_PAGE && stat.encoding == Encoding::PLAIN) { + dict_pages += stat.count; + } else if (stat.page_type == PageType::DATA_PAGE) { + if (stat.encoding == Encoding::RLE_DICTIONARY) { + rle_dict_pages += stat.count; + } else if (stat.encoding == Encoding::DELTA_LENGTH_BYTE_ARRAY) { + dlba_pages += stat.count; + } else if (stat.encoding == Encoding::PLAIN) { + plain_data_pages += stat.count; + } + } + } + EXPECT_EQ(dict_pages, 1); + EXPECT_GE(rle_dict_pages, 1); + EXPECT_GE(dlba_pages, 1); + EXPECT_EQ(plain_data_pages, 0); + + ASSERT_OK_AND_ASSIGN(auto reader, OpenFile(std::make_shared(buffer), + ::arrow::default_memory_pool())); + ASSERT_OK_AND_ASSIGN(auto actual, reader->ReadTable()); + auto expected = ::arrow::Table::Make( + ::arrow::schema({::arrow::field("values", ::arrow::utf8())}), + {ArrayFromJSON(::arrow::utf8(), R"(["a", "b", "a", "b", "c", "d", "c", "d"])")}); + ::arrow::AssertTablesEqual(*expected, *actual); +} + // ---------------------------------------------------------------------- // Tests for directly reading DictionaryArray diff --git a/cpp/src/parquet/column_writer.cc b/cpp/src/parquet/column_writer.cc index fbd34677b03..bc9dccb6597 100644 --- a/cpp/src/parquet/column_writer.cc +++ b/cpp/src/parquet/column_writer.cc @@ -744,7 +744,8 @@ class ColumnWriterImpl { public: ColumnWriterImpl(ColumnChunkMetaDataBuilder* metadata, std::unique_ptr pager, const bool use_dictionary, - Encoding::type encoding, const WriterProperties* properties, + Encoding::type encoding, Encoding::type fallback_encoding, + const WriterProperties* properties, internal::ContentDefinedChunker* content_defined_chunker) : metadata_(metadata), descr_(metadata->descr()), @@ -752,6 +753,7 @@ class ColumnWriterImpl { pager_(std::move(pager)), has_dictionary_(use_dictionary), encoding_(encoding), + fallback_encoding_(fallback_encoding), properties_(properties), allocator_(properties->memory_pool()), num_buffered_values_(0), @@ -857,6 +859,7 @@ class ColumnWriterImpl { bool has_dictionary_; Encoding::type encoding_; + const Encoding::type fallback_encoding_; const WriterProperties* properties_; LevelEncoder level_encoder_; @@ -894,7 +897,7 @@ class ColumnWriterImpl { // Flag to check if the Writer has been closed bool closed_; - // Flag to infer if dictionary encoding has fallen back to PLAIN + // Flag to infer if dictionary encoding has fallen back bool fallback_; ::arrow::BufferBuilder definition_levels_sink_; @@ -1030,7 +1033,7 @@ void ColumnWriterImpl::BuildDataPageV1(int64_t definition_levels_rle_size, int64_t first_row_index = rows_written_ - num_buffered_rows_; // Write the page to OutputStream eagerly if there is no dictionary or - // if dictionary encoding has fallen back to PLAIN + // if dictionary encoding has fallen back if (has_dictionary_ && !fallback_) { // Save pages until end of dictionary encoding PARQUET_ASSIGN_OR_THROW( auto compressed_data_copy, @@ -1093,7 +1096,7 @@ void ColumnWriterImpl::BuildDataPageV2(int64_t definition_levels_rle_size, DCHECK(!page_stats.has_null_count || page_stats.null_count == null_count); // Write the page to OutputStream eagerly if there is no dictionary or - // if dictionary encoding has fallen back to PLAIN + // if dictionary encoding has fallen back if (has_dictionary_ && !fallback_) { // Save pages until end of dictionary encoding std::unique_ptr page_ptr = std::make_unique( combined, num_values, null_count, num_rows, encoding_, def_levels_byte_length, @@ -1287,11 +1290,18 @@ class TypedColumnWriterImpl : public ColumnWriterImpl, TypedColumnWriterImpl(ColumnChunkMetaDataBuilder* metadata, std::unique_ptr pager, const bool use_dictionary, - Encoding::type encoding, const WriterProperties* properties, - BloomFilter* bloom_filter, + Encoding::type encoding, Encoding::type fallback_encoding, + const WriterProperties* properties, BloomFilter* bloom_filter, internal::ContentDefinedChunker* content_defined_chunker) - : ColumnWriterImpl(metadata, std::move(pager), use_dictionary, encoding, properties, - content_defined_chunker) { + : ColumnWriterImpl(metadata, std::move(pager), use_dictionary, encoding, + fallback_encoding, properties, content_defined_chunker) { + if (use_dictionary && fallback_encoding != Encoding::PLAIN) { + // Build the fallback encoder upfront so an unsupported encoding/type pair + // fails on ColumnWriter creation rather than mid-row-group on overflow. + fallback_encoder_ = + MakeEncoder(ParquetType::type_num, fallback_encoding, + /*use_dictionary=*/false, descr_, properties->memory_pool()); + } current_encoder_ = MakeEncoder(ParquetType::type_num, encoding, use_dictionary, descr_, properties->memory_pool()); // We have to dynamic_cast as some compilers don't want to static_cast @@ -1683,6 +1693,8 @@ class TypedColumnWriterImpl : public ColumnWriterImpl, std::shared_ptr chunk_geospatial_statistics_; std::unique_ptr bloom_filter_writer_; bool pages_change_on_record_boundaries_; + // Pre-built non-PLAIN fallback encoder, swapped in on dictionary overflow. + std::unique_ptr fallback_encoder_; // If writing a sequence of ::arrow::DictionaryArray to the writer, we keep the // dictionary passed to DictEncoder::PutDictionary so we can check @@ -1874,25 +1886,26 @@ class TypedColumnWriterImpl : public ColumnWriterImpl, // Serialize the buffered Dictionary Indices FlushBufferedDataPages(); fallback_ = true; - // Only PLAIN encoding is supported for fallback - current_encoder_ = MakeEncoder(ParquetType::type_num, Encoding::PLAIN, false, - descr_, properties_->memory_pool()); + current_encoder_ = fallback_encoder_ != nullptr + ? std::move(fallback_encoder_) + : MakeEncoder(ParquetType::type_num, Encoding::PLAIN, false, + descr_, properties_->memory_pool()); current_value_encoder_ = dynamic_cast(current_encoder_.get()); current_dict_encoder_ = nullptr; // not using dict - encoding_ = Encoding::PLAIN; + encoding_ = fallback_encoding_; } } // Checks if the Dictionary Page size limit is reached // If the limit is reached, the Dictionary and Data Pages are serialized - // The encoding is switched to PLAIN + // The encoding is switched to fallback_encoding_ (PLAIN by default) // // Only one Dictionary Page is written. - // Fallback to PLAIN if dictionary page limit is reached. + // Fallback to fallback_encoding_ if dictionary page limit is reached. void CheckDictionarySizeLimit() { if (!has_dictionary_ || fallback_) { // Either not using dictionary encoding, or we have already fallen back - // to PLAIN encoding because the size threshold was reached + // to the non-dictionary encoding because the size threshold was reached return; } @@ -2733,54 +2746,53 @@ std::shared_ptr ColumnWriter::Make( const ColumnDescriptor* descr = metadata->descr(); const bool use_dictionary = properties->dictionary_enabled(descr->path()) && descr->physical_type() != Type::BOOLEAN; - Encoding::type encoding = properties->encoding(descr->path()); - if (encoding == Encoding::UNKNOWN) { - encoding = (descr->physical_type() == Type::BOOLEAN && - properties->version() != ParquetVersion::PARQUET_1_0 && - properties->data_page_version() == ParquetDataPageVersion::V2) - ? Encoding::RLE - : Encoding::PLAIN; - } - if (use_dictionary) { - encoding = properties->dictionary_index_encoding(); - } + Encoding::type fallback_encoding = properties->encoding(descr->path()); + if (fallback_encoding == Encoding::UNKNOWN) { + fallback_encoding = (descr->physical_type() == Type::BOOLEAN && + properties->version() != ParquetVersion::PARQUET_1_0 && + properties->data_page_version() == ParquetDataPageVersion::V2) + ? Encoding::RLE + : Encoding::PLAIN; + } + const Encoding::type encoding = + use_dictionary ? properties->dictionary_index_encoding() : fallback_encoding; switch (descr->physical_type()) { case Type::BOOLEAN: { if (bloom_filter != nullptr) { throw ParquetException("Bloom filter is not supported for boolean type"); } return std::make_shared>( - metadata, std::move(pager), use_dictionary, encoding, properties, - /*bloom_filter=*/nullptr, content_defined_chunker); + metadata, std::move(pager), use_dictionary, encoding, fallback_encoding, + properties, /*bloom_filter=*/nullptr, content_defined_chunker); } case Type::INT32: return std::make_shared>( - metadata, std::move(pager), use_dictionary, encoding, properties, bloom_filter, - content_defined_chunker); + metadata, std::move(pager), use_dictionary, encoding, fallback_encoding, + properties, bloom_filter, content_defined_chunker); case Type::INT64: return std::make_shared>( - metadata, std::move(pager), use_dictionary, encoding, properties, bloom_filter, - content_defined_chunker); + metadata, std::move(pager), use_dictionary, encoding, fallback_encoding, + properties, bloom_filter, content_defined_chunker); case Type::INT96: return std::make_shared>( - metadata, std::move(pager), use_dictionary, encoding, properties, bloom_filter, - content_defined_chunker); + metadata, std::move(pager), use_dictionary, encoding, fallback_encoding, + properties, bloom_filter, content_defined_chunker); case Type::FLOAT: return std::make_shared>( - metadata, std::move(pager), use_dictionary, encoding, properties, bloom_filter, - content_defined_chunker); + metadata, std::move(pager), use_dictionary, encoding, fallback_encoding, + properties, bloom_filter, content_defined_chunker); case Type::DOUBLE: return std::make_shared>( - metadata, std::move(pager), use_dictionary, encoding, properties, bloom_filter, - content_defined_chunker); + metadata, std::move(pager), use_dictionary, encoding, fallback_encoding, + properties, bloom_filter, content_defined_chunker); case Type::BYTE_ARRAY: return std::make_shared>( - metadata, std::move(pager), use_dictionary, encoding, properties, bloom_filter, - content_defined_chunker); + metadata, std::move(pager), use_dictionary, encoding, fallback_encoding, + properties, bloom_filter, content_defined_chunker); case Type::FIXED_LEN_BYTE_ARRAY: return std::make_shared>( - metadata, std::move(pager), use_dictionary, encoding, properties, bloom_filter, - content_defined_chunker); + metadata, std::move(pager), use_dictionary, encoding, fallback_encoding, + properties, bloom_filter, content_defined_chunker); default: ParquetException::NYI("Column writer not implemented for type: " + TypeToString(descr->physical_type())); diff --git a/cpp/src/parquet/column_writer_test.cc b/cpp/src/parquet/column_writer_test.cc index cd553ffe35d..dd10656f22e 100644 --- a/cpp/src/parquet/column_writer_test.cc +++ b/cpp/src/parquet/column_writer_test.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -2621,5 +2622,188 @@ TEST_F(TestDoubleValuesWriter, AlpAllNullDataPageV2) { this->TestAlpOptionalDataPageV2(/*num_nulls=*/SMALL_SIZE); } +namespace { + +int32_t CountEncodingStatPages(const ColumnChunkMetaData& col_meta, + PageType::type page_type, Encoding::type encoding) { + int32_t total = 0; + for (const auto& stat : col_meta.encoding_stats()) { + if (stat.page_type == page_type && stat.encoding == encoding) { + total += stat.count; + } + } + return total; +} + +template +std::vector ReadFixedColumn(RowGroupReader* rgr, int col, int num_rows) { + auto reader = std::static_pointer_cast(rgr->Column(col)); + std::vector out(num_rows); + int64_t total_read = 0; + while (reader->HasNext()) { + int64_t values_read = 0; + int64_t levels_read = reader->ReadBatch(num_rows - total_read, nullptr, nullptr, + out.data() + total_read, &values_read); + EXPECT_EQ(levels_read, values_read); + EXPECT_GT(levels_read, 0); + total_read += values_read; + } + EXPECT_EQ(num_rows, total_read); + return out; +} + +} // namespace + +TEST(TestColumnWriter, ConfiguredDictionaryFallbackEncoding) { + constexpr int kRows = 40; + std::vector str_backing(kRows); + std::vector str_vals(kRows); + std::vector def_levels(kRows, 1); + std::vector valid_bytes(kRows, 1); + std::vector expected_spaced_non_null; + std::vector i64_vals(kRows); + std::vector f64_vals(kRows); + + for (int i = 0; i < kRows; ++i) { + str_backing[i] = (i < 10) ? ("dup_" + std::to_string(i % 2)) + : (i >= 30) ? "" + : ("unique_fallback_val_" + std::to_string(i)); + str_vals[i] = ByteArray(static_cast(str_backing[i].size()), + reinterpret_cast(str_backing[i].data())); + if (i % 4 == 0) { + def_levels[i] = 0; + valid_bytes[i] = 0; + } else { + expected_spaced_non_null.push_back(str_backing[i]); + } + i64_vals[i] = (i < 10) ? (i % 2) : (10000 + i * 37); + f64_vals[i] = (i < 10) ? static_cast(i % 2) : (100.0 + 0.125 * i); + } + ASSERT_OK_AND_ASSIGN(auto valid_bits, ::arrow::internal::BytesToBits(valid_bytes)); + + auto schema = std::static_pointer_cast( + GroupNode::Make("schema", Repetition::REQUIRED, + { + schema::ByteArray("dlba", Repetition::REQUIRED), + schema::ByteArray("dlba_spaced", Repetition::OPTIONAL), + schema::ByteArray("dba", Repetition::REQUIRED), + schema::Int64("i64_delta", Repetition::REQUIRED), + schema::Double("f64_bss", Repetition::REQUIRED), + schema::Double("f64_alp", Repetition::REQUIRED), + })); + + const std::vector expected_fallbacks = { + Encoding::DELTA_LENGTH_BYTE_ARRAY, Encoding::DELTA_LENGTH_BYTE_ARRAY, + Encoding::DELTA_BYTE_ARRAY, Encoding::DELTA_BINARY_PACKED, + Encoding::BYTE_STREAM_SPLIT, Encoding::ALP, + }; + + for (ParquetDataPageVersion page_version : + {ParquetDataPageVersion::V1, ParquetDataPageVersion::V2}) { + SCOPED_TRACE(page_version == ParquetDataPageVersion::V1 ? "V1" : "V2"); + auto sink = CreateOutputStream(); + auto props = WriterProperties::Builder() + .version(ParquetVersion::PARQUET_2_6) + ->data_page_version(page_version) + ->dictionary_pagesize_limit(64) + ->write_batch_size(10) + ->data_pagesize(1) + ->encoding("dlba", Encoding::DELTA_LENGTH_BYTE_ARRAY) + ->encoding("dlba_spaced", Encoding::DELTA_LENGTH_BYTE_ARRAY) + ->encoding("dba", Encoding::DELTA_BYTE_ARRAY) + ->encoding("i64_delta", Encoding::DELTA_BINARY_PACKED) + ->encoding("f64_bss", Encoding::BYTE_STREAM_SPLIT) + ->encoding("f64_alp", Encoding::ALP) + ->build(); + + auto fw = ParquetFileWriter::Open(sink, schema, props); + auto rg = fw->AppendRowGroup(); + static_cast(rg->NextColumn()) + ->WriteBatch(kRows, nullptr, nullptr, str_vals.data()); + static_cast(rg->NextColumn()) + ->WriteBatchSpaced(kRows, def_levels.data(), nullptr, valid_bits->data(), 0, + str_vals.data()); + static_cast(rg->NextColumn()) + ->WriteBatch(kRows, nullptr, nullptr, str_vals.data()); + static_cast(rg->NextColumn()) + ->WriteBatch(kRows, nullptr, nullptr, i64_vals.data()); + static_cast(rg->NextColumn()) + ->WriteBatch(kRows, nullptr, nullptr, f64_vals.data()); + static_cast(rg->NextColumn()) + ->WriteBatch(kRows, nullptr, nullptr, f64_vals.data()); + ASSERT_NO_THROW(fw->Close()); + ASSERT_OK_AND_ASSIGN(auto buffer, sink->Finish()); + + auto fr = + ParquetFileReader::Open(std::make_shared<::arrow::io::BufferReader>(buffer)); + auto rg_meta = fr->metadata()->RowGroup(0); + for (int col = 0; col < static_cast(expected_fallbacks.size()); ++col) { + auto m = rg_meta->ColumnChunk(col); + EXPECT_TRUE(m->has_dictionary_page()) << "col=" << col; + EXPECT_EQ(1, CountEncodingStatPages(*m, PageType::DICTIONARY_PAGE, Encoding::PLAIN)) + << "col=" << col; + EXPECT_GE(CountEncodingStatPages(*m, PageType::DATA_PAGE, Encoding::RLE_DICTIONARY), + 1) + << "col=" << col; + EXPECT_GE(CountEncodingStatPages(*m, PageType::DATA_PAGE, expected_fallbacks[col]), + 1) + << "col=" << col; + EXPECT_EQ(0, CountEncodingStatPages(*m, PageType::DATA_PAGE, Encoding::PLAIN)) + << "col=" << col; + } + + auto rgr = fr->RowGroup(0); + auto read_strings = [&](int col, std::vector* out_def) { + auto reader = std::static_pointer_cast(rgr->Column(col)); + std::vector out; + int64_t total_levels = 0; + while (reader->HasNext()) { + std::vector batch(kRows); + int64_t values_read = 0; + int16_t* def_ptr = out_def != nullptr ? out_def->data() + total_levels : nullptr; + int64_t levels_read = reader->ReadBatch(kRows - total_levels, def_ptr, nullptr, + batch.data(), &values_read); + EXPECT_GT(levels_read, 0); + total_levels += levels_read; + for (int64_t j = 0; j < values_read; ++j) { + out.emplace_back(reinterpret_cast(batch[j].ptr), batch[j].len); + } + } + EXPECT_EQ(kRows, total_levels); + return out; + }; + + EXPECT_EQ(str_backing, read_strings(0, nullptr)); + std::vector out_def(kRows); + EXPECT_EQ(expected_spaced_non_null, read_strings(1, &out_def)); + EXPECT_EQ(def_levels, out_def); + EXPECT_EQ(str_backing, read_strings(2, nullptr)); + + EXPECT_EQ(i64_vals, (ReadFixedColumn(rgr.get(), 3, kRows))); + EXPECT_EQ(f64_vals, (ReadFixedColumn(rgr.get(), 4, kRows))); + EXPECT_EQ(f64_vals, (ReadFixedColumn(rgr.get(), 5, kRows))); + } +} + +TEST(TestColumnWriter, IncompatibleDictionaryFallbackEncodingThrows) { + const std::vector> cases = { + {schema::Int64("col", Repetition::REQUIRED), Encoding::DELTA_LENGTH_BYTE_ARRAY}, + {schema::ByteArray("col", Repetition::REQUIRED), Encoding::DELTA_BINARY_PACKED}, + {schema::ByteArray("col", Repetition::REQUIRED), Encoding::BYTE_STREAM_SPLIT}, + {schema::Int64("col", Repetition::REQUIRED), Encoding::ALP}, + }; + for (const auto& [col_node, bad_encoding] : cases) { + auto schema = std::static_pointer_cast( + GroupNode::Make("schema", Repetition::REQUIRED, {col_node})); + auto props = WriterProperties::Builder() + .enable_dictionary() + ->encoding("col", bad_encoding) + ->build(); + auto fw = ParquetFileWriter::Open(CreateOutputStream(), schema, props); + auto rg = fw->AppendRowGroup(); + EXPECT_THROW(rg->NextColumn(), ParquetException); + } +} + } // namespace test } // namespace parquet diff --git a/cpp/src/parquet/properties.h b/cpp/src/parquet/properties.h index dc0cc2e3a4e..377b89c73b5 100644 --- a/cpp/src/parquet/properties.h +++ b/cpp/src/parquet/properties.h @@ -565,8 +565,8 @@ class PARQUET_EXPORT WriterProperties { /// \brief Define the encoding that is used when we don't utilise dictionary encoding. // - /// This is only applied if dictionary encoding is disabled. If the dictionary grows - /// too large we always fall back to the PLAIN encoding. + /// This is applied if dictionary encoding is disabled, or if we fall back when the + /// dictionary grows too large. Builder* encoding(Encoding::type encoding_type) { if (encoding_type == Encoding::PLAIN_DICTIONARY || encoding_type == Encoding::RLE_DICTIONARY) { @@ -579,8 +579,8 @@ class PARQUET_EXPORT WriterProperties { /// \brief Define the encoding that is used when we don't utilise dictionary encoding. // - /// This is only applied if dictionary encoding is disabled. If the dictionary grows - /// too large we always fall back to the PLAIN encoding. + /// This is applied if dictionary encoding is disabled, or if we fall back when the + /// dictionary grows too large. Builder* encoding(const std::string& path, Encoding::type encoding_type) { if (encoding_type == Encoding::PLAIN_DICTIONARY || encoding_type == Encoding::RLE_DICTIONARY) { @@ -593,8 +593,8 @@ class PARQUET_EXPORT WriterProperties { /// \brief Define the encoding that is used when we don't utilise dictionary encoding. // - /// This is only applied if dictionary encoding is disabled. If the dictionary grows - /// too large we always fall back to the PLAIN encoding. + /// This is applied if dictionary encoding is disabled, or if we fall back when the + /// dictionary grows too large. Builder* encoding(const std::shared_ptr& path, Encoding::type encoding_type) { return this->encoding(path->ToDotString(), encoding_type);