This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new d41d0ed56aa [opt](variant) Release materialized V2 writers one column
at a time (#71103)
d41d0ed56aa is described below
commit d41d0ed56aa5c245b8d1a5c9b10763312d685509
Author: lihangyu <[email protected]>
AuthorDate: Wed Dec 2 10:48:45 2026 +0800
[opt](variant) Release materialized V2 writers one column at a time (#71103)
### Background
The VARIANT V2 shredder selects paths to store as independent columns.
Each path's writer encodes data pages and builds the indexes for that
column. The segment writer packages the resulting inverted indexes in
the segment's index file.
### What problem does this PR solve?
Issue Number: None
Related PR: None
PR Type: Performance
Problem Summary:
On a 5,000-path table with 50 present keys per row, a three-way Stream
Load used a median 7.00 GiB of additional BE heap. Completing and
releasing each path's writer before allocating the next reduced that
median to 0.35 GiB in the 4.1 Release comparison. Cloud index-only
prewarming now leaves interleaved inline index pages for queries to read
on demand.
### Details
- **Why it was slow:** Per-path dictionary buffers and index builders
accumulate across paths and concurrent flushes. Prewarming interleaved
indexes fetches whole cache blocks that also contain data.
- **Optimization:** Finish and write each materialized path's data and
indexes within the path loop. Count the inline index bytes separately
from scheduled prewarm ranges. The segment writer still packages the
inverted indexes, and the index-only loader still prewarms the segment
tail and footer.
- **Results:** In the original 4.1 Release comparison, three
simultaneous loads with eight timed runs and eight sampled runs per arm
took 1.206 to 0.966 s. Median sampled jemalloc peak fell from 8.19 to
1.57 GiB and RSS peak fell from 4.65 to 2.85 GiB. Optimized V1 in that
comparison took 1.027 s with a 1.50 GiB heap peak and 2.66 GiB RSS peak.
The master follow-up compares two per-path release builds on the same
896 rows and 5,000 paths at 1% density. Each arm ran 32 times in
reversed order on a Release Cloud cluster with 32 pinned logical CPUs
and local MinIO. Actual S3 reads include prewarm and the first MATCH_ANY
query with one additional path projected.
| Publication warmup | Block | Segment | Stream Load P50, ms | First
query P95, ms | S3 read P50, MiB |
| --- | ---: | --- | ---: | ---: | ---: |
| Default | 4 KiB | V2 | 1729.5 → 1048.2 | 110.2 → 131.2 | 3.38 → 3.38 |
| Default | 4 KiB | V3 | 1708.4 → 1046.7 | 90.7 → 103.6 | 3.36 → 3.36 |
| Default | 1 MiB | V2 | 1299.9 → 1178.8 | 133.4 → 140.0 | 3.38 → 3.38 |
| Default | 1 MiB | V3 | 1307.1 → 1184.9 | 128.6 → 131.5 | 3.36 → 3.36 |
| Inverted indexes only | 4 KiB | V2 | 1388.3 → 831.8 | 85.3 → 91.8 |
3.38 → 1.05 |
| Inverted indexes only | 4 KiB | V3 | 1340.0 → 840.1 | 79.9 → 84.4 |
3.36 → 1.13 |
| Inverted indexes only | 1 MiB | V2 | 757.5 → 764.4 | 75.8 → 98.7 |
3.38 → 2.38 |
| Inverted indexes only | 1 MiB | V3 | 754.3 → 775.3 | 63.0 → 80.9 |
3.36 → 2.36 |
- **Applicability and cost:** Applies to full V2 writes with
materialized paths. The default rowset publication task warms the
remaining data, which explains the unchanged S3 totals. Turning on the
existing `file_cache_enable_only_warm_up_idx` setting on the same
candidate at 1 MiB saved 1 MiB per Segment through the first selective
query. Its P95 changed from 84.1 to 98.7 ms for storage V2 and from 75.4
to 80.9 ms for V3. V2 P95 moved in opposite directions between rounds.
At 4 KiB with that setting, the full-column control read the same S3
bytes and its first-query median rose from 171–203 to 942–944 ms. The PR
retains the default publication policy. The original 24-column dense
control had 310 versus 320 ms medians and changed direction when the
order was reversed.
### Testing
- Release Stream Load checked all 5,000 physical paths and exact row IDs
from index-only MATCH_ANY.
- The pre-follow-up master BE reopened the same V2 and V3 Segment
objects from an empty cache. Both formats passed the wide and dictionary
overflow fixtures, exact row/null reads, packed inverted-index checks
and MATCH_ANY.
- The follow-up passed 31 scoped ASAN tests, including the exact
cache-range and index-byte-accounting assertion. Format, build hygiene
and changed-line clang-tidy passed.
- Earlier per-column writer validation passed 77 scoped ASAN tests and
42 of 44 V2 regression suites, including SNII. Two suites stopped before
their first load when an external fixture returned HTTP 403.
### Release note
Reduces BE memory during loads of wide VARIANT V2 tables and reduces
synchronous Cloud prewarming for scattered inline indexes.
### Check List (For Author)
- Behavior changed: No
- Does this need documentation: No
- Pre-submission status: Partially verified: two cases in the earlier
full V2 regression run could not load an external fixture.
### AI Disclosure
- Tool: OpenAI Codex (GPT-6)
- Generated: C++ changes, tests, benchmark harness, and description.
- Human review: No author review recorded at submission time.
---
be/src/storage/segment/column_writer.h | 2 +
.../segment/variant/v2/variant_column_writer.cpp | 71 ++++++++++-----------
.../segment/variant/v2/variant_column_writer.h | 9 ++-
be/src/storage/segment/vertical_segment_writer.cpp | 5 ++
be/src/storage/segment/vertical_segment_writer.h | 1 +
.../storage/rowset/segment_flusher_format_test.cpp | 36 +++++++++++
.../segment_0.dat | Bin 5588 -> 5588 bytes
.../segment_1.dat | Bin 5590 -> 5590 bytes
.../segment_0.dat | Bin 5404 -> 5404 bytes
.../segment_1.dat | Bin 5406 -> 5406 bytes
.../segment_0.dat | Bin 5448 -> 5448 bytes
.../segment_1.dat | Bin 5260 -> 5260 bytes
.../segment_0.dat | Bin 5264 -> 5264 bytes
.../segment_1.dat | Bin 5076 -> 5076 bytes
.../segment_0.dat | Bin 5584 -> 5584 bytes
.../segment_1.dat | Bin 5584 -> 5584 bytes
.../segment_0.dat | Bin 5400 -> 5400 bytes
.../segment_1.dat | Bin 5400 -> 5400 bytes
.../segment_0.dat | Bin 5386 -> 5387 bytes
.../segment_1.dat | Bin 5163 -> 5164 bytes
.../segment_0.dat | Bin 5202 -> 5202 bytes
.../segment_1.dat | Bin 4979 -> 4980 bytes
.../variant_row_store_0_horizontal/segment_0.dat | Bin 3515 -> 3515 bytes
.../variant_row_store_0_horizontal/segment_1.dat | Bin 3527 -> 3527 bytes
.../variant_row_store_1_vertical/segment_0.dat | Bin 3517 -> 3517 bytes
.../variant_row_store_1_vertical/segment_1.dat | Bin 3529 -> 3529 bytes
.../variant_row_store_2_horizontal/segment_0.dat | Bin 3515 -> 3515 bytes
.../variant_row_store_2_horizontal/segment_1.dat | Bin 3527 -> 3527 bytes
.../variant_row_store_3_vertical/segment_0.dat | Bin 3515 -> 3515 bytes
.../variant_row_store_3_vertical/segment_1.dat | Bin 3527 -> 3527 bytes
.../segment_0.dat | Bin 2856 -> 2856 bytes
.../segment_1.dat | Bin 3058 -> 3057 bytes
.../segment_2.dat | Bin 2450 -> 2450 bytes
.../variant/variant_column_writer_reader_test.cpp | 20 ++++--
34 files changed, 97 insertions(+), 47 deletions(-)
diff --git a/be/src/storage/segment/column_writer.h
b/be/src/storage/segment/column_writer.h
index 3b102dc95dd..e4a8c3b8303 100644
--- a/be/src/storage/segment/column_writer.h
+++ b/be/src/storage/segment/column_writer.h
@@ -95,6 +95,8 @@ struct ColumnWriterOptions {
SegmentFooterPB* footer = nullptr;
io::FileWriter* file_writer = nullptr;
+ // Count inline index pages that materialized VARIANT paths write
alongside their data.
+ uint64_t* inline_index_bytes = nullptr;
CompressionTypePB compression_type = UNKNOWN_COMPRESSION;
RowsetWriterContext* rowset_ctx = nullptr;
// For collect segment statistics for compaction
diff --git a/be/src/storage/segment/variant/v2/variant_column_writer.cpp
b/be/src/storage/segment/variant/v2/variant_column_writer.cpp
index fdf210bd692..fbfc9dff76c 100644
--- a/be/src/storage/segment/variant/v2/variant_column_writer.cpp
+++ b/be/src/storage/segment/variant/v2/variant_column_writer.cpp
@@ -18,6 +18,7 @@
#include "storage/segment/variant/v2/variant_column_writer.h"
#include <algorithm>
+#include <functional>
#include <limits>
#include <utility>
@@ -31,6 +32,7 @@
#include "core/column/variant_v2/column_variant_v2.h"
#include "exec/common/variant_util.h"
#include "exprs/function/parse/variant_jsonb_parse.h"
+#include "io/fs/file_writer.h"
#include "storage/index/index_file_writer.h"
#include "storage/rowset/rowset_writer_context.h"
#include "storage/segment/variant/v2/variant_assembler.h"
@@ -248,9 +250,27 @@ Status VariantV2ColumnWriter::_write_materialized(const
VariantShreddedColumns&
RETURN_IF_ERROR(variant_writer_helpers::append_sparse_column(
tablet_column, writer.get(), path_column.type,
path_column.column,
path_column.rowids, _num_rows));
- _subcolumn_indexes.push_back(std::move(indexes));
- _subcolumn_opts.push_back(opts);
- _subcolumn_writers.push_back(std::move(writer));
+ // Drain this path before the next writer allocates its page and index
builders.
+ RETURN_IF_ERROR(writer->finish());
+ RETURN_IF_ERROR(writer->write_data());
+ _materialized_raw_data_bytes += writer->get_raw_data_bytes();
+ _materialized_uncompressed_data_bytes +=
writer->get_total_uncompressed_data_pages_bytes();
+ _materialized_compressed_data_bytes +=
writer->get_total_compressed_data_pages_bytes();
+ const uint64_t index_start = _opts.file_writer->bytes_appended();
+ RETURN_IF_ERROR(writer->write_ordinal_index());
+ if (opts.need_zone_map) {
+ RETURN_IF_ERROR(writer->write_zone_map());
+ }
+ if (opts.need_bloom_filter) {
+ RETURN_IF_ERROR(writer->write_bloom_filter_index());
+ }
+ if (_opts.inline_index_bytes != nullptr) {
+ *_opts.inline_index_bytes += _opts.file_writer->bytes_appended() -
index_start;
+ }
+ if (opts.need_inverted_index) {
+ // Finalize the column index while the segment still owns its
files for packing.
+ RETURN_IF_ERROR(writer->write_inverted_index());
+ }
}
return Status::OK();
}
@@ -373,19 +393,9 @@ Status VariantV2ColumnWriter::finalize() {
return Status::OK();
}
-Status VariantV2ColumnWriter::_for_each_column_writer(
- const std::function<Status(ColumnWriter*)>& function) {
- DORIS_CHECK(_root_writer != nullptr);
- RETURN_IF_ERROR(function(_root_writer.get()));
- for (auto& writer : _subcolumn_writers) {
- RETURN_IF_ERROR(function(writer.get()));
- }
- return Status::OK();
-}
-
Status VariantV2ColumnWriter::finish() {
RETURN_IF_ERROR(finalize());
- RETURN_IF_ERROR(_for_each_column_writer([](ColumnWriter* writer) { return
writer->finish(); }));
+ RETURN_IF_ERROR(_root_writer->finish());
if (_binary_writer != nullptr) {
RETURN_IF_ERROR(_binary_writer->finish());
}
@@ -394,8 +404,7 @@ Status VariantV2ColumnWriter::finish() {
Status VariantV2ColumnWriter::write_data() {
RETURN_IF_ERROR(finalize());
- RETURN_IF_ERROR(
- _for_each_column_writer([](ColumnWriter* writer) { return
writer->write_data(); }));
+ RETURN_IF_ERROR(_root_writer->write_data());
if (_binary_writer != nullptr) {
RETURN_IF_ERROR(_binary_writer->write_data());
}
@@ -404,8 +413,7 @@ Status VariantV2ColumnWriter::write_data() {
Status VariantV2ColumnWriter::write_ordinal_index() {
DORIS_CHECK(_is_finalized);
- RETURN_IF_ERROR(_for_each_column_writer(
- [](ColumnWriter* writer) { return writer->write_ordinal_index();
}));
+ RETURN_IF_ERROR(_root_writer->write_ordinal_index());
if (_binary_writer != nullptr) {
RETURN_IF_ERROR(_binary_writer->write_ordinal_index());
}
@@ -414,11 +422,6 @@ Status VariantV2ColumnWriter::write_ordinal_index() {
Status VariantV2ColumnWriter::write_zone_map() {
DORIS_CHECK(_is_finalized);
- for (size_t index = 0; index < _subcolumn_writers.size(); ++index) {
- if (_subcolumn_opts[index].need_zone_map) {
- RETURN_IF_ERROR(_subcolumn_writers[index]->write_zone_map());
- }
- }
if (_binary_writer != nullptr) {
RETURN_IF_ERROR(_binary_writer->write_zone_map());
}
@@ -430,11 +433,6 @@ Status VariantV2ColumnWriter::write_inverted_index() {
for (auto& writer : _values_index_writers) {
RETURN_IF_ERROR(writer->finish());
}
- for (size_t index = 0; index < _subcolumn_writers.size(); ++index) {
- if (_subcolumn_opts[index].need_inverted_index) {
- RETURN_IF_ERROR(_subcolumn_writers[index]->write_inverted_index());
- }
- }
if (_binary_writer != nullptr) {
RETURN_IF_ERROR(_binary_writer->write_inverted_index());
}
@@ -443,11 +441,6 @@ Status VariantV2ColumnWriter::write_inverted_index() {
Status VariantV2ColumnWriter::write_bloom_filter_index() {
DORIS_CHECK(_is_finalized);
- for (size_t index = 0; index < _subcolumn_writers.size(); ++index) {
- if (_subcolumn_opts[index].need_bloom_filter) {
-
RETURN_IF_ERROR(_subcolumn_writers[index]->write_bloom_filter_index());
- }
- }
if (_binary_writer != nullptr) {
RETURN_IF_ERROR(_binary_writer->write_bloom_filter_index());
}
@@ -464,9 +457,6 @@ uint64_t VariantV2ColumnWriter::estimate_buffer_size() {
return _outer_nulls->byte_size() + _shredder->byte_size();
}
uint64_t size = _root_writer->estimate_buffer_size();
- for (const auto& writer : _subcolumn_writers) {
- size += writer->estimate_buffer_size();
- }
if (_binary_writer != nullptr) {
size += _binary_writer->estimate_buffer_size();
}
@@ -477,8 +467,13 @@ uint64_t VariantV2ColumnWriter::get_total_data_pages_bytes(
ColumnWriter::DataBytesGetter getter) const {
DORIS_CHECK(_is_finalized);
uint64_t size = std::invoke(getter, _root_writer.get());
- for (const auto& writer : _subcolumn_writers) {
- size += std::invoke(getter, writer.get());
+ if (getter == &ColumnWriter::get_raw_data_bytes) {
+ size += _materialized_raw_data_bytes;
+ } else if (getter ==
&ColumnWriter::get_total_uncompressed_data_pages_bytes) {
+ size += _materialized_uncompressed_data_bytes;
+ } else {
+ DCHECK(getter == &ColumnWriter::get_total_compressed_data_pages_bytes);
+ size += _materialized_compressed_data_bytes;
}
if (_binary_writer != nullptr) {
size += _binary_writer->get_total_data_pages_bytes(getter);
diff --git a/be/src/storage/segment/variant/v2/variant_column_writer.h
b/be/src/storage/segment/variant/v2/variant_column_writer.h
index 1ca8bec8e4c..cc73be66482 100644
--- a/be/src/storage/segment/variant/v2/variant_column_writer.h
+++ b/be/src/storage/segment/variant/v2/variant_column_writer.h
@@ -17,7 +17,6 @@
#pragma once
-#include <functional>
#include <memory>
#include <span>
#include <vector>
@@ -68,7 +67,6 @@ private:
Status _append_root_batch(const ColumnString& batch, std::span<const
uint8_t> outer_nulls);
Status _write_materialized(const VariantShreddedColumns& shredded, int&
column_id);
Status _write_binary(const VariantShreddedColumns& shredded, int&
column_id);
- Status _for_each_column_writer(const std::function<Status(ColumnWriter*)>&
function);
ColumnWriterOptions _opts;
const TabletColumn* _tablet_column = nullptr;
@@ -79,9 +77,10 @@ private:
bool _is_finalized = false;
std::unique_ptr<ColumnWriter> _root_writer;
- std::vector<std::unique_ptr<ColumnWriter>> _subcolumn_writers;
- std::vector<ColumnWriterOptions> _subcolumn_opts;
- std::vector<TabletIndexes> _subcolumn_indexes;
+ // Keep the data-page statistics after the materialized writers are
released.
+ uint64_t _materialized_raw_data_bytes = 0;
+ uint64_t _materialized_uncompressed_data_bytes = 0;
+ uint64_t _materialized_compressed_data_bytes = 0;
std::unique_ptr<VariantBinaryWriter> _binary_writer;
std::vector<std::unique_ptr<VariantValuesIndexWriter>>
_values_index_writers;
};
diff --git a/be/src/storage/segment/vertical_segment_writer.cpp
b/be/src/storage/segment/vertical_segment_writer.cpp
index a59bb390e25..108528d6302 100644
--- a/be/src/storage/segment/vertical_segment_writer.cpp
+++ b/be/src/storage/segment/vertical_segment_writer.cpp
@@ -287,6 +287,7 @@ Status VerticalSegmentWriter::_create_column_writer(size_t
pos, uint32_t cid,
opts.rowset_ctx = _opts.rowset_ctx;
opts.file_writer = _file_writer;
+ opts.inline_index_bytes = &_inline_index_bytes;
opts.compression_type = _opts.compression_type;
opts.footer = &_footer;
if (_opts.rowset_ctx != nullptr) {
@@ -768,6 +769,10 @@ Status VerticalSegmentWriter::finalize_columns(uint64_t*
index_size) {
}
}
uint64_t file_index_end = _file_writer->bytes_appended();
+ // Readers fetch inline VARIANT indexes through their page pointers.
Preloading them would
+ // fetch whole cache blocks, including data pages between nearby indexes
in wide segments.
+ *index_size += _inline_index_bytes;
+ _inline_index_bytes = 0;
_index_file_cache_info.add_index_range(index_start, file_index_end -
index_start);
// reset all column writers
clear();
diff --git a/be/src/storage/segment/vertical_segment_writer.h
b/be/src/storage/segment/vertical_segment_writer.h
index cb1d49ca575..1fbbc3df640 100644
--- a/be/src/storage/segment/vertical_segment_writer.h
+++ b/be/src/storage/segment/vertical_segment_writer.h
@@ -250,6 +250,7 @@ private:
SegmentFooterPB _footer;
SegmentIndexFileCacheInfo _index_file_cache_info;
+ uint64_t _inline_index_bytes = 0;
size_t _num_short_key_columns;
std::unique_ptr<ShortKeyIndexBuilder> _short_key_index_builder;
diff --git a/be/test/storage/rowset/segment_flusher_format_test.cpp
b/be/test/storage/rowset/segment_flusher_format_test.cpp
index cdb194caeaf..d967cdf0f86 100644
--- a/be/test/storage/rowset/segment_flusher_format_test.cpp
+++ b/be/test/storage/rowset/segment_flusher_format_test.cpp
@@ -3982,6 +3982,42 @@ TEST_F(SegmentFlusherFormatTest,
EmbeddedAndExternalIndexesKeepTheirSegmentBytes
}
}
+TEST_F(SegmentFlusherFormatTest,
InlineVariantIndexesCountTowardSizeWithoutPreloading) {
+ auto schema = create_complex_value_schema(TABLET_STORAGE_FORMAT_V3,
+
/*nullable_complex_values=*/false,
+
/*with_variant_bloom_filter=*/true);
+ auto block = create_complex_value_block(schema, /*segment_id=*/0,
/*nullable_values=*/false);
+ ASSERT_TRUE(block.has_value()) << block.error();
+ io::FileWriterPtr file_writer;
+ ASSERT_TRUE(io::global_local_filesystem()
+
->create_file(fmt::format("{}/inline_variant_indexes.dat", kTestDir),
+ &file_writer)
+ .ok());
+
+ RowsetWriterContext context;
+ context.tablet_schema = schema;
+ context.write_type = DataWriteType::TYPE_DIRECT;
+ segment_v2::VerticalSegmentWriterOptions opts;
+ opts.rowset_ctx = &context;
+ segment_v2::VerticalSegmentWriter writer(file_writer.get(), 0, schema,
nullptr, nullptr, opts,
+ nullptr);
+ ASSERT_TRUE(writer.write_block(&block.value(), 0,
block.value().rows()).ok());
+ const uint64_t tail_start = file_writer->bytes_appended();
+ uint64_t index_size = 0;
+ ASSERT_TRUE(writer.finalize_columns(&index_size).ok());
+ const uint64_t footer_start = file_writer->bytes_appended();
+ EXPECT_GT(index_size, footer_start - tail_start);
+
+ uint64_t segment_size = 0;
+ segment_v2::SegmentIndexFileCacheInfo preload;
+ ASSERT_TRUE(writer.finalize_footer(&segment_size, &preload).ok());
+ ASSERT_EQ(preload.index_ranges.size(), 2);
+ EXPECT_EQ(preload.index_ranges[0].offset, tail_start);
+ EXPECT_EQ(preload.index_ranges[0].size, footer_start - tail_start);
+ EXPECT_EQ(preload.index_ranges[1].offset, footer_start);
+ EXPECT_EQ(preload.index_ranges[1].size, segment_size - footer_start);
+}
+
TEST_F(SegmentFlusherFormatTest,
ComplexObjectAndVariantValuesKeepTheirSegmentBytes) {
constexpr int32_t kNoCompressionThresholdKb = 1'000'000;
struct ComplexCase {
diff --git
a/be/test/storage/test_data/segment_flusher_format/complex_v2_not_nullable_with_variant_bloom_horizontal_compressed/segment_0.dat
b/be/test/storage/test_data/segment_flusher_format/complex_v2_not_nullable_with_variant_bloom_horizontal_compressed/segment_0.dat
index f4c19d63ff3..3a0f024852a 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/complex_v2_not_nullable_with_variant_bloom_horizontal_compressed/segment_0.dat
and
b/be/test/storage/test_data/segment_flusher_format/complex_v2_not_nullable_with_variant_bloom_horizontal_compressed/segment_0.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/complex_v2_not_nullable_with_variant_bloom_horizontal_compressed/segment_1.dat
b/be/test/storage/test_data/segment_flusher_format/complex_v2_not_nullable_with_variant_bloom_horizontal_compressed/segment_1.dat
index dcdd42cbf18..48de596df17 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/complex_v2_not_nullable_with_variant_bloom_horizontal_compressed/segment_1.dat
and
b/be/test/storage/test_data/segment_flusher_format/complex_v2_not_nullable_with_variant_bloom_horizontal_compressed/segment_1.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/complex_v2_not_nullable_without_variant_bloom_horizontal_compressed/segment_0.dat
b/be/test/storage/test_data/segment_flusher_format/complex_v2_not_nullable_without_variant_bloom_horizontal_compressed/segment_0.dat
index c18164da395..fabc8799cb3 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/complex_v2_not_nullable_without_variant_bloom_horizontal_compressed/segment_0.dat
and
b/be/test/storage/test_data/segment_flusher_format/complex_v2_not_nullable_without_variant_bloom_horizontal_compressed/segment_0.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/complex_v2_not_nullable_without_variant_bloom_horizontal_compressed/segment_1.dat
b/be/test/storage/test_data/segment_flusher_format/complex_v2_not_nullable_without_variant_bloom_horizontal_compressed/segment_1.dat
index 027959a37a1..0e6151662c4 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/complex_v2_not_nullable_without_variant_bloom_horizontal_compressed/segment_1.dat
and
b/be/test/storage/test_data/segment_flusher_format/complex_v2_not_nullable_without_variant_bloom_horizontal_compressed/segment_1.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/complex_v2_nullable_with_variant_bloom_vertical_uncompressed/segment_0.dat
b/be/test/storage/test_data/segment_flusher_format/complex_v2_nullable_with_variant_bloom_vertical_uncompressed/segment_0.dat
index 776cac5ba8f..ad487403cb3 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/complex_v2_nullable_with_variant_bloom_vertical_uncompressed/segment_0.dat
and
b/be/test/storage/test_data/segment_flusher_format/complex_v2_nullable_with_variant_bloom_vertical_uncompressed/segment_0.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/complex_v2_nullable_with_variant_bloom_vertical_uncompressed/segment_1.dat
b/be/test/storage/test_data/segment_flusher_format/complex_v2_nullable_with_variant_bloom_vertical_uncompressed/segment_1.dat
index 83ec1ff3d36..4808f98c4d3 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/complex_v2_nullable_with_variant_bloom_vertical_uncompressed/segment_1.dat
and
b/be/test/storage/test_data/segment_flusher_format/complex_v2_nullable_with_variant_bloom_vertical_uncompressed/segment_1.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/complex_v2_nullable_without_variant_bloom_vertical_compressed/segment_0.dat
b/be/test/storage/test_data/segment_flusher_format/complex_v2_nullable_without_variant_bloom_vertical_compressed/segment_0.dat
index 6a6a987fd58..26014eea768 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/complex_v2_nullable_without_variant_bloom_vertical_compressed/segment_0.dat
and
b/be/test/storage/test_data/segment_flusher_format/complex_v2_nullable_without_variant_bloom_vertical_compressed/segment_0.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/complex_v2_nullable_without_variant_bloom_vertical_compressed/segment_1.dat
b/be/test/storage/test_data/segment_flusher_format/complex_v2_nullable_without_variant_bloom_vertical_compressed/segment_1.dat
index c525473cbd2..804e9c8f0b8 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/complex_v2_nullable_without_variant_bloom_vertical_compressed/segment_1.dat
and
b/be/test/storage/test_data/segment_flusher_format/complex_v2_nullable_without_variant_bloom_vertical_compressed/segment_1.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/complex_v3_not_nullable_with_variant_bloom_vertical_compressed/segment_0.dat
b/be/test/storage/test_data/segment_flusher_format/complex_v3_not_nullable_with_variant_bloom_vertical_compressed/segment_0.dat
index 274293b55a6..38ef5fa7e79 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/complex_v3_not_nullable_with_variant_bloom_vertical_compressed/segment_0.dat
and
b/be/test/storage/test_data/segment_flusher_format/complex_v3_not_nullable_with_variant_bloom_vertical_compressed/segment_0.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/complex_v3_not_nullable_with_variant_bloom_vertical_compressed/segment_1.dat
b/be/test/storage/test_data/segment_flusher_format/complex_v3_not_nullable_with_variant_bloom_vertical_compressed/segment_1.dat
index 50b2ccd9208..b93b12f371e 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/complex_v3_not_nullable_with_variant_bloom_vertical_compressed/segment_1.dat
and
b/be/test/storage/test_data/segment_flusher_format/complex_v3_not_nullable_with_variant_bloom_vertical_compressed/segment_1.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/complex_v3_not_nullable_without_variant_bloom_vertical_uncompressed/segment_0.dat
b/be/test/storage/test_data/segment_flusher_format/complex_v3_not_nullable_without_variant_bloom_vertical_uncompressed/segment_0.dat
index 1605671feda..6686b402865 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/complex_v3_not_nullable_without_variant_bloom_vertical_uncompressed/segment_0.dat
and
b/be/test/storage/test_data/segment_flusher_format/complex_v3_not_nullable_without_variant_bloom_vertical_uncompressed/segment_0.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/complex_v3_not_nullable_without_variant_bloom_vertical_uncompressed/segment_1.dat
b/be/test/storage/test_data/segment_flusher_format/complex_v3_not_nullable_without_variant_bloom_vertical_uncompressed/segment_1.dat
index 98df5f82029..a477aca530c 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/complex_v3_not_nullable_without_variant_bloom_vertical_uncompressed/segment_1.dat
and
b/be/test/storage/test_data/segment_flusher_format/complex_v3_not_nullable_without_variant_bloom_vertical_uncompressed/segment_1.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/complex_v3_nullable_with_variant_bloom_horizontal_compressed/segment_0.dat
b/be/test/storage/test_data/segment_flusher_format/complex_v3_nullable_with_variant_bloom_horizontal_compressed/segment_0.dat
index 30ac1ee33ed..b4389e3a7ea 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/complex_v3_nullable_with_variant_bloom_horizontal_compressed/segment_0.dat
and
b/be/test/storage/test_data/segment_flusher_format/complex_v3_nullable_with_variant_bloom_horizontal_compressed/segment_0.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/complex_v3_nullable_with_variant_bloom_horizontal_compressed/segment_1.dat
b/be/test/storage/test_data/segment_flusher_format/complex_v3_nullable_with_variant_bloom_horizontal_compressed/segment_1.dat
index 1b055d7e1fd..2d1996fb8bd 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/complex_v3_nullable_with_variant_bloom_horizontal_compressed/segment_1.dat
and
b/be/test/storage/test_data/segment_flusher_format/complex_v3_nullable_with_variant_bloom_horizontal_compressed/segment_1.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/complex_v3_nullable_without_variant_bloom_horizontal_compressed/segment_0.dat
b/be/test/storage/test_data/segment_flusher_format/complex_v3_nullable_without_variant_bloom_horizontal_compressed/segment_0.dat
index e6abeb09547..467dd00f40d 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/complex_v3_nullable_without_variant_bloom_horizontal_compressed/segment_0.dat
and
b/be/test/storage/test_data/segment_flusher_format/complex_v3_nullable_without_variant_bloom_horizontal_compressed/segment_0.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/complex_v3_nullable_without_variant_bloom_horizontal_compressed/segment_1.dat
b/be/test/storage/test_data/segment_flusher_format/complex_v3_nullable_without_variant_bloom_horizontal_compressed/segment_1.dat
index 156d248d7ad..472a20b8678 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/complex_v3_nullable_without_variant_bloom_horizontal_compressed/segment_1.dat
and
b/be/test/storage/test_data/segment_flusher_format/complex_v3_nullable_without_variant_bloom_horizontal_compressed/segment_1.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_0_horizontal/segment_0.dat
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_0_horizontal/segment_0.dat
index 5273fd05748..96ad56bbe29 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_0_horizontal/segment_0.dat
and
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_0_horizontal/segment_0.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_0_horizontal/segment_1.dat
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_0_horizontal/segment_1.dat
index ddd81eb8f4d..2cdcb73e888 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_0_horizontal/segment_1.dat
and
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_0_horizontal/segment_1.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_1_vertical/segment_0.dat
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_1_vertical/segment_0.dat
index 0d221a14cf9..b848c756314 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_1_vertical/segment_0.dat
and
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_1_vertical/segment_0.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_1_vertical/segment_1.dat
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_1_vertical/segment_1.dat
index 4eb8de195a4..40dc1f11211 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_1_vertical/segment_1.dat
and
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_1_vertical/segment_1.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_2_horizontal/segment_0.dat
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_2_horizontal/segment_0.dat
index 5273fd05748..96ad56bbe29 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_2_horizontal/segment_0.dat
and
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_2_horizontal/segment_0.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_2_horizontal/segment_1.dat
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_2_horizontal/segment_1.dat
index ddd81eb8f4d..2cdcb73e888 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_2_horizontal/segment_1.dat
and
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_2_horizontal/segment_1.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_3_vertical/segment_0.dat
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_3_vertical/segment_0.dat
index 0d08884ec60..079a4338209 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_3_vertical/segment_0.dat
and
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_3_vertical/segment_0.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_3_vertical/segment_1.dat
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_3_vertical/segment_1.dat
index 19744cf5b27..3e2d9aa837f 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_3_vertical/segment_1.dat
and
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_3_vertical/segment_1.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_segment_creator/segment_0.dat
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_segment_creator/segment_0.dat
index f9625d6766c..9a37e26400d 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_segment_creator/segment_0.dat
and
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_segment_creator/segment_0.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_segment_creator/segment_1.dat
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_segment_creator/segment_1.dat
index 74a3a39f727..e7fb98e4f83 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_segment_creator/segment_1.dat
and
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_segment_creator/segment_1.dat
differ
diff --git
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_segment_creator/segment_2.dat
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_segment_creator/segment_2.dat
index af4d09fc4be..17fc3ce2733 100644
Binary files
a/be/test/storage/test_data/segment_flusher_format/variant_row_store_segment_creator/segment_2.dat
and
b/be/test/storage/test_data/segment_flusher_format/variant_row_store_segment_creator/segment_2.dat
differ
diff --git a/be/test/storage/variant/variant_column_writer_reader_test.cpp
b/be/test/storage/variant/variant_column_writer_reader_test.cpp
index 691b5687878..ecf1da7d9de 100644
--- a/be/test/storage/variant/variant_column_writer_reader_test.cpp
+++ b/be/test/storage/variant/variant_column_writer_reader_test.cpp
@@ -1486,6 +1486,15 @@ TEST(VariantColumnIndexBindingTest,
RenamedRootKeepsStoredSubpathIndexSuffix) {
}
}
+static void expect_data_and_inline_index_bytes(const ColumnWriter& writer,
+ const io::FileWriter&
file_writer,
+ uint64_t inline_index_bytes) {
+ // Materialized paths write inline indexes alongside their data. The
compressed data count
+ // still includes those paths' data pages and excludes their index pages.
+ EXPECT_EQ(writer.get_total_compressed_data_pages_bytes() +
inline_index_bytes,
+ file_writer.bytes_appended());
+}
+
class VariantColumnWriterReaderTest : public testing::Test {
public:
// Parent VARIANT column with an extracted VARIANT subcolumn `v.payload`,
i.e. the layout
@@ -1900,9 +1909,11 @@ protected:
rowset_ctx.tablet_path = _tablet->tablet_path();
TabletColumn column = _tablet_schema->column(0);
+ uint64_t inline_index_bytes = 0;
ColumnWriterOptions opts;
opts.meta = footer->add_columns();
opts.index_file_writer = index_file_writer.get();
+ opts.inline_index_bytes = &inline_index_bytes;
opts.compression_type = CompressionTypePB::LZ4;
opts.file_writer = file_writer.get();
opts.footer = footer;
@@ -1930,8 +1941,7 @@ protected:
RETURN_IF_ERROR(writer->finish());
RETURN_IF_ERROR(writer->write_data());
- // The file holds only the data pages of this variant so far.
- EXPECT_EQ(writer->get_total_compressed_data_pages_bytes(),
file_writer->bytes_appended());
+ expect_data_and_inline_index_bytes(*writer, *file_writer,
inline_index_bytes);
RETURN_IF_ERROR(writer->write_ordinal_index());
RETURN_IF_ERROR(writer->write_zone_map());
if (index_write_policy == VariantIndexWritePolicy::BLOOM_AND_INVERTED)
{
@@ -4234,7 +4244,9 @@ TEST_F(VariantColumnWriterReaderTest,
test_write_data_normal) {
// 4. create column_writer
SegmentFooterPB footer;
+ uint64_t inline_index_bytes = 0;
ColumnWriterOptions opts;
+ opts.inline_index_bytes = &inline_index_bytes;
opts.meta = footer.add_columns();
opts.compression_type = CompressionTypePB::LZ4;
opts.file_writer = file_writer.get();
@@ -4264,8 +4276,8 @@ TEST_F(VariantColumnWriterReaderTest,
test_write_data_normal) {
EXPECT_TRUE(st.ok()) << st.msg();
st = writer->write_data();
EXPECT_TRUE(st.ok()) << st.msg();
- // The root, the subcolumns and the sparse columns all count to the
variant.
- EXPECT_EQ(writer->get_total_compressed_data_pages_bytes(),
file_writer->bytes_appended());
+ ASSERT_GT(inline_index_bytes, 0);
+ expect_data_and_inline_index_bytes(*writer, *file_writer,
inline_index_bytes);
EXPECT_GT(writer->get_total_uncompressed_data_pages_bytes(), 0);
EXPECT_GT(writer->get_raw_data_bytes(), 0);
st = writer->write_ordinal_index();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]