hello-stephen commented on code in PR #71108:
URL: https://github.com/apache/doris/pull/71108#discussion_r4730492270


##########
be/src/storage/segment/variant/variant_column_writer_impl.cpp:
##########
@@ -1513,10 +1515,39 @@ Status 
VariantV1ColumnWriter::_process_regular_doc_value_staging(ColumnVariant*
     RETURN_IF_ERROR(execute_doc_write_pipeline(
             *ptr, num_rows, 0 /* materialize selected paths regardless of row 
count */, column_id,
             [this, num_rows, converter](SubcolumnWriteEntry& entry, int& 
materialized_column_id) {
-                return write_materialized_subcolumn(*_tablet_column, 
entry.path, *entry.subcolumn,
-                                                    num_rows, converter, 
materialized_column_id,
-                                                    _opts, 
&_subcolumns_indexes, &_subcolumn_opts,
-                                                    &_subcolumn_writers, 
entry.rowids);
+                const size_t writer_count = _subcolumn_writers.size();
+                RETURN_IF_ERROR(write_materialized_subcolumn(
+                        *_tablet_column, entry.path, *entry.subcolumn, 
num_rows, converter,
+                        materialized_column_id, _opts, &_subcolumns_indexes, 
&_subcolumn_opts,
+                        &_subcolumn_writers, entry.rowids));
+                if (_subcolumn_writers.size() == writer_count) {
+                    return Status::OK();
+                }
+
+                auto* writer = _subcolumn_writers.back().get();
+                const auto& opts = _subcolumn_opts.back();
+                RETURN_IF_ERROR(finish_and_write_column_writer(writer));
+                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());
+                }
+                const uint64_t index_size = 
_opts.file_writer->bytes_appended() - index_start;
+                if (index_size != 0 && _opts.early_index_ranges != nullptr) {
+                    _opts.early_index_ranges->push_back({index_start, 
index_size});
+                }
+                if (opts.need_inverted_index) {
+                    RETURN_IF_ERROR(writer->write_inverted_index());
+                }
+                // Release the child before opening the next path. The segment 
keeps the
+                // finalized inverted-index files for packing and writes the 
footer later.
+                _subcolumn_writers.pop_back();

Review Comment:
   [P2] Preserve V1 materialized-path byte totals before releasing writers
   
   For ordinary V1 VARIANT loads using the default storage-parse mode, each 
selected materialized path reaches this pop. 
`VariantV1ColumnWriter::get_total_data_pages_bytes()` still sums only live 
`_subcolumn_writers` and has no saved counters, so these paths vanish from all 
three byte totals. Both segment writers persist those incomplete totals in the 
root footer, causing `information_schema.column_data_sizes` to underreport 
compressed, uncompressed and raw data sizes. Save and aggregate the counters 
before releasing each writer, as the V2 path does.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to