Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.9k
[fix](zonemap) Treat unparsable zone map as invalid#67341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+132
−31
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -143,6 +143,40 @@ Status build_segment_zonemap_context(Segment* segment, const ReadSchema& schema, | ||
| return Status::OK(); | ||
| } | ||
| // The statistics iterator answers pushed-down aggregates from the segment zone maps alone. An | ||
| // invalid zone map has no min/max to answer with, so the caller has to read the data instead. | ||
| Status segment_zone_maps_can_answer_agg(Segment* segment, const ReadSchema& schema, | ||
| const StorageReadOptions& read_options, bool* usable) { | ||
| *usable = true; | ||
| for (size_t ordinal = 0; ordinal < schema.num_block_columns(); ++ordinal) { | ||
| // The commit-tso column is only served correctly once its reader is created with the | ||
| // rowset's commit_tso as a const value. Creating it here without one would cache a reader | ||
| // that hands every later read the on-disk placeholder instead. | ||
| if (static_cast<int32_t>(ordinal) == schema.commit_tso_ordinal()) { | ||
| continue; | ||
| } | ||
| std::shared_ptr<ColumnReader> reader; | ||
| Status st = segment->get_column_reader(*schema.column(ordinal), &reader, read_options.stats, | ||
csun5285 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| &read_options.io_ctx); | ||
| if (st.is<ErrorCode::NOT_FOUND>()) { | ||
| continue; | ||
| } | ||
| RETURN_IF_ERROR(st); | ||
| // Columns without a zone map keep the existing behaviour: the statistics iterator reports | ||
| // the missing zone map itself. | ||
| if (reader == nullptr || !reader->has_zone_map()) { | ||
| continue; | ||
| } | ||
| ZoneMap zone_map; | ||
| RETURN_IF_ERROR(reader->get_segment_zone_map(&zone_map)); | ||
| if (zone_map.pass_all) { | ||
| *usable = false; | ||
| return Status::OK(); | ||
| } | ||
| } | ||
| return Status::OK(); | ||
| } | ||
| void fill_missing_decimal_precision(const TabletColumn& column, ColumnMetaPB* meta) { | ||
| auto meta_type = static_cast<FieldType>(meta->type()); | ||
| if (meta_type != column.type()) { | ||
| @@ -469,9 +503,18 @@ Status Segment::new_iterator(ReadSchemaSPtr schema, const StorageReadOptions& re | ||
| RETURN_IF_ERROR(load_index(read_options.stats, &read_options.io_ctx)); | ||
| } | ||
| if (read_options.delete_condition_predicates->num_of_column_predicate() == 0 && | ||
| read_options.push_down_agg_type_opt != TPushAggOp::NONE && | ||
| read_options.push_down_agg_type_opt != TPushAggOp::COUNT_ON_INDEX) { | ||
| bool use_statistics_iterator = | ||
| read_options.delete_condition_predicates->num_of_column_predicate() == 0 && | ||
| read_options.push_down_agg_type_opt != TPushAggOp::NONE && | ||
| read_options.push_down_agg_type_opt != TPushAggOp::COUNT_ON_INDEX; | ||
| // COUNT only fills defaults, every other pushed-down aggregate reads min/max out of the | ||
| // segment zone maps. | ||
| if (use_statistics_iterator && read_options.push_down_agg_type_opt != TPushAggOp::COUNT) { | ||
| bool usable = false; | ||
| RETURN_IF_ERROR(segment_zone_maps_can_answer_agg(this, *schema, read_options, &usable)); | ||
| use_statistics_iterator = usable; | ||
| } | ||
| if (use_statistics_iterator) { | ||
| iter->reset(new_vstatistics_iterator(this->shared_from_this(), *schema)); | ||
| } else { | ||
| *iter = std::make_unique<SegmentIterator>(this->shared_from_this(), schema); | ||
14 changes: 14 additions & 0 deletions
14 be/test/core/data_type_serde/data_type_serde_number_test.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass_allis the state this PR uses for legacy bounds such as the old DBL_MAX rendering, but this branch turns it back into a query error.Segment::new_iteratorstill selectsVStatisticsIteratorfor MINMAX when delete predicates are empty, andVStatisticsIterator::next_batchpropagates this status, so MIN/MAX over an otherwise readable old segment fails instead of scanning conservatively. Please disable the statistics fast path or fall back to a normalSegmentIteratorwhen the segment zone map is unusable, and add a regression covering the MINMAX path.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
当前版本的 segment zone map 是对的,老版本的是可能不对的