forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 18
Fix Iceberg read optimization returning NULLs for stats-less manifests (#1545) — antalya-26.3 #1814
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
Open
il9ue
wants to merge
2
commits into
Altinity:antalya-26.3
Choose a base branch
from
il9ue:fix/iceberg-empty-stats-26.3
base: antalya-26.3
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,7 +104,9 @@ DataFileMetaInfo::DataFileMetaInfo( | |
| Int32 table_schema_id, | ||
| Int32 file_schema_id, | ||
| const std::unordered_map<Int32, Iceberg::ColumnInfo> & columns_info_, | ||
| const std::unordered_map<Int32, std::pair<Field, Field>> & value_bounds_) | ||
| const std::unordered_map<Int32, std::pair<Field, Field>> & value_bounds_, | ||
| bool any_stats_field_present) | ||
| : stats_were_read(any_stats_field_present) | ||
| { | ||
| #if USE_AVRO | ||
| std::vector<Int32> column_ids; | ||
|
|
@@ -180,6 +182,10 @@ DataFileMetaInfo::DataFileMetaInfo(Poco::JSON::Object::Ptr file_info) | |
|
|
||
| auto log = getLogger("DataFileMetaInfo"); | ||
|
|
||
| // Missing field means old coordinator — default to false (safe: no absent-NULL). | ||
| if (file_info->has("stats_were_read")) | ||
| stats_were_read = static_cast<bool>(file_info->get("stats_were_read").convert<bool>()); | ||
|
|
||
| if (file_info->has("columns")) | ||
| { | ||
| auto columns = file_info->getArray("columns"); | ||
|
|
@@ -225,6 +231,8 @@ Poco::JSON::Object::Ptr DataFileMetaInfo::toJson() const | |
| { | ||
| Poco::JSON::Object::Ptr file_info = new Poco::JSON::Object(); | ||
|
|
||
| file_info->set("stats_were_read", stats_were_read); | ||
|
|
||
| if (!columns_info.empty()) | ||
| { | ||
| Poco::JSON::Array::Ptr columns = new Poco::JSON::Array(); | ||
|
|
@@ -256,6 +264,7 @@ constexpr size_t FIELD_MASK_ALL = 0x7; | |
|
|
||
| void DataFileMetaInfo::serialize(WriteBuffer & out) const | ||
| { | ||
| writeIntBinary(static_cast<UInt8>(stats_were_read), out); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this break backward compatibility? |
||
| auto size = columns_info.size(); | ||
| writeIntBinary(size, out); | ||
| for (const auto & column : columns_info) | ||
|
|
@@ -286,6 +295,10 @@ DataFileMetaInfo DataFileMetaInfo::deserialize(ReadBuffer & in) | |
| { | ||
| DataFileMetaInfo result; | ||
|
|
||
| UInt8 stats_were_read_uint; | ||
| readIntBinary(stats_were_read_uint, in); | ||
| result.stats_were_read = static_cast<bool>(stats_were_read_uint); | ||
|
|
||
| size_t size; | ||
| readIntBinary(size, in); | ||
|
|
||
|
|
||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Is it valid, when avro metadata does not contain column information?