HIVE-29265: Columns failed stats computation still marked as COLUMN_STATS_ACCURATE#6576
Open
cyanzheng2926 wants to merge 3 commits into
Open
HIVE-29265: Columns failed stats computation still marked as COLUMN_STATS_ACCURATE#6576cyanzheng2926 wants to merge 3 commits into
cyanzheng2926 wants to merge 3 commits into
Conversation
…ats collection fails When column stats collection is skipped (e.g. UnsupportedDoubleException for Inf/NaN in float/double min/max stats), failed columns were still makred as true in COLUMN_STATS_ACCURATE even though stats are not present. Track per-table/partition column failures in ColStatsProcessor and remove incorrect accurate markers via alterTable and alterPartitions.
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



/<!--
Thanks for sending a pull request! Here are some tips for you:
-->
What changes were proposed in this pull request?
When stats collection is skipped for some columns with hive.stats.reliable=false, no stats are written to the metastore, but COLUMN_STATS_ACCURATE still remains "true" for these columns.
Updated ColStatsProcessor to track for columns that failed stats gathering due to such errors, and remove the stale accurate markers for these columns.
Note on limitations:
Non-native partitioned tables (e.g. Iceberg) only table-level cleanup is done, since currently there is no storage-handler API to clear partition-level COLUMN_STATS_ACCURATE.
Marker removal is using alterPartitions and alterTable with transactional=false, since these are parameter-only metadata updates, and the pre-existing setOrRemoveColumnStatsAccurateProperty success path is currently implemented in the same way.
Why are the changes needed?
Column stats collection can fail for individual columns (e.g. UnsupportedDoubleException with Infinity/NaN). With hive.stats.reliable=false the failure is logged and skipped, but still leaves COLUMN_STATS_ACCURATE claiming those columns are accurate even though no stats were stored. The optimizer may use non-existent stats and produce suboptimal or incorrect plans as a result.
Does this PR introduce any user-facing change?
Yes.
could show COLUMN_STATS_ACCURATE with "column":"true" even when COLUMN_STATS was missing for that column.Before: After a partial or total column-stats failure, DESCRIBE FORMATTED
After: Failed columns are removed from COLUMN_STATS_ACCURATE. Only columns with successfully collected stats remain marked accurate.
How was this patch tested?
Added qtest: stats_col_stats_inaccurate.q and corresponding golden, test for multiple cases when certain columns of partitioned/non-partitioned tables fail at stats gathering with Infinity/NaN, and desc formatted output should not return COLUMN_STATS_ACCURATE markers for these columns