-
Notifications
You must be signed in to change notification settings - Fork 4.8k
HIVE-29473: prevent combining stats between SELECT and LV fields #6331
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
Draft
konstantinb
wants to merge
3
commits into
apache:master
Choose a base branch
from
konstantinb:HIVE-29473
base: master
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.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
533bce5
HIVE-29473: preventing stats override of select columns with 2+ LVs
konstantinb 9f854a3
HIVE-29473: better use of existing methods/libraries, unit testing an…
konstantinb 7f48c9d
HIVE-29473: further code optimizxations + bug-specific test file
konstantinb 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
385 changes: 385 additions & 0 deletions
385
...st/org/apache/hadoop/hive/ql/optimizer/stats/annotation/TestLateralViewJoinStatsRule.java
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| create table lvj_stats (id string, f1 string); | ||
|
|
||
| insert into lvj_stats values | ||
| ('a','v1'), ('a','v2'), ('a','v3'), | ||
| ('b','v4'), ('b','v5'), ('b','v6'); | ||
|
|
||
| analyze table lvj_stats compute statistics; | ||
| analyze table lvj_stats compute statistics for columns; | ||
|
|
||
| -- Test that LV columns' stats no longer inflate SELECT columns' sizes | ||
| explain | ||
| select id, f1, count(*) | ||
| from (select id, f1 from lvj_stats group by id, f1) sub | ||
| lateral view posexplode(array(f1, f1)) t1 as pos1, val1 | ||
| group by id, f1; | ||
|
|
||
| select id, f1, count(*) | ||
| from (select id, f1 from lvj_stats group by id, f1) sub | ||
| lateral view posexplode(array(f1, f1)) t1 as pos1, val1 | ||
| group by id, f1; | ||
|
|
||
| -- Test that LV columns' stats no longer override NDV of a base column | ||
| alter table lvj_stats update statistics for column id set('numDVs'='0','numNulls'='0'); | ||
|
|
||
| explain | ||
| select id, count(*) | ||
| from (select id, f1 from lvj_stats group by id, f1) sub | ||
| lateral view posexplode(array(f1, f1)) t1 as pos1, val1 | ||
| group by id; | ||
|
|
||
| select id, count(*) | ||
| from (select id, f1 from lvj_stats group by id, f1) sub | ||
| lateral view posexplode(array(f1, f1)) t1 as pos1, val1 | ||
| group by id; |
216 changes: 108 additions & 108 deletions
216
ql/src/test/results/clientpositive/llap/annotate_stats_lateral_view_join.q.out
Large diffs are not rendered by default.
Oops, something went wrong.
360 changes: 360 additions & 0 deletions
360
ql/src/test/results/clientpositive/llap/lvj_stats_isolation.q.out
Large diffs are not rendered by default.
Oops, something went wrong.
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.
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.
This is a typical example of LV column stats impacting the data size estimations of SELECT columns:
` Column Naming
The UDTF branch's column generator restarts at 0, so its internal stats use _col0 for the array expression — colliding with SELECT's _col0.
Processing Comparison
Final Column Statistics
Data Size — LVJ Debug Output (500 rows)
Data Size — EXPLAIN Output (500 rows)