-
Notifications
You must be signed in to change notification settings - Fork 4.8k
HIVE-29166: Fix the partition column update logic in ConvertJoinMapJoin#convertJoinBucketMapJoin. #6048
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
kasakrisz
merged 3 commits into
apache:master
from
ngsg:HIVE-29166-fix-BucketMapJoin-conversion
Sep 4, 2025
+222
−20
Merged
HIVE-29166: Fix the partition column update logic in ConvertJoinMapJoin#convertJoinBucketMapJoin. #6048
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions
9
iceberg/iceberg-handler/src/test/queries/positive/bucket_map_join_9.q
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,9 @@ | ||
set hive.auto.convert.join=true; | ||
set hive.convert.join.bucket.mapjoin.tez=true; | ||
|
||
CREATE TABLE tbl (foid string, part string, id string) PARTITIONED BY SPEC(bucket(10, id), bucket(10, part)) STORED BY ICEBERG; | ||
INSERT INTO tbl VALUES ('1234', 'PART_123', '1'), ('1235', 'PART_124', '2'); | ||
|
||
EXPLAIN | ||
SELECT * FROM tbl JOIN tbl tbl2 ON tbl.id = tbl2.id AND tbl.part = tbl2.part; | ||
SELECT * FROM tbl JOIN tbl tbl2 ON tbl.id = tbl2.id AND tbl.part = tbl2.part; |
65 changes: 65 additions & 0 deletions
65
iceberg/iceberg-handler/src/test/results/positive/bucket_map_join_9.q.out
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,65 @@ | ||
PREHOOK: query: CREATE TABLE tbl (foid string, part string, id string) PARTITIONED BY SPEC(bucket(10, id), bucket(10, part)) STORED BY ICEBERG | ||
PREHOOK: type: CREATETABLE | ||
PREHOOK: Output: database:default | ||
PREHOOK: Output: default@tbl | ||
POSTHOOK: query: CREATE TABLE tbl (foid string, part string, id string) PARTITIONED BY SPEC(bucket(10, id), bucket(10, part)) STORED BY ICEBERG | ||
POSTHOOK: type: CREATETABLE | ||
POSTHOOK: Output: database:default | ||
POSTHOOK: Output: default@tbl | ||
PREHOOK: query: INSERT INTO tbl VALUES ('1234', 'PART_123', '1'), ('1235', 'PART_124', '2') | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: _dummy_database@_dummy_table | ||
PREHOOK: Output: default@tbl | ||
POSTHOOK: query: INSERT INTO tbl VALUES ('1234', 'PART_123', '1'), ('1235', 'PART_124', '2') | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: _dummy_database@_dummy_table | ||
POSTHOOK: Output: default@tbl | ||
PREHOOK: query: EXPLAIN | ||
SELECT * FROM tbl JOIN tbl tbl2 ON tbl.id = tbl2.id AND tbl.part = tbl2.part | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: default@tbl | ||
PREHOOK: Output: hdfs://### HDFS PATH ### | ||
POSTHOOK: query: EXPLAIN | ||
SELECT * FROM tbl JOIN tbl tbl2 ON tbl.id = tbl2.id AND tbl.part = tbl2.part | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: default@tbl | ||
POSTHOOK: Output: hdfs://### HDFS PATH ### | ||
Plan optimized by CBO. | ||
|
||
Vertex dependency in root stage | ||
Map 1 <- Map 2 (CUSTOM_EDGE) | ||
|
||
Stage-0 | ||
Fetch Operator | ||
limit:-1 | ||
Stage-1 | ||
Map 1 vectorized | ||
File Output Operator [FS_53] | ||
Map Join Operator [MAPJOIN_52] (rows=2 width=530) | ||
BucketMapJoin:true,Conds:SEL_51._col1, _col2=RS_49._col1, _col2(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5"] | ||
<-Map 2 [CUSTOM_EDGE] vectorized | ||
MULTICAST [RS_49] | ||
PartitionCols:_col2, _col1 | ||
Select Operator [SEL_48] (rows=2 width=265) | ||
Output:["_col0","_col1","_col2"] | ||
Filter Operator [FIL_47] (rows=2 width=265) | ||
predicate:(id is not null and part is not null) | ||
TableScan [TS_3] (rows=2 width=265) | ||
default@tbl,tbl2,Tbl:COMPLETE,Col:COMPLETE,Output:["foid","part","id"] | ||
<-Select Operator [SEL_51] (rows=2 width=265) | ||
Output:["_col0","_col1","_col2"] | ||
Filter Operator [FIL_50] (rows=2 width=265) | ||
predicate:(id is not null and part is not null) | ||
TableScan [TS_0] (rows=2 width=265) | ||
default@tbl,tbl,Tbl:COMPLETE,Col:COMPLETE,Grouping Num Buckets:100,Grouping Partition Columns:["id","part"],Output:["foid","part","id"] | ||
|
||
PREHOOK: query: SELECT * FROM tbl JOIN tbl tbl2 ON tbl.id = tbl2.id AND tbl.part = tbl2.part | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: default@tbl | ||
PREHOOK: Output: hdfs://### HDFS PATH ### | ||
POSTHOOK: query: SELECT * FROM tbl JOIN tbl tbl2 ON tbl.id = tbl2.id AND tbl.part = tbl2.part | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: default@tbl | ||
POSTHOOK: Output: hdfs://### HDFS PATH ### | ||
1234 PART_123 1 1234 PART_123 1 | ||
1235 PART_124 2 1235 PART_124 2 |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
set hive.auto.convert.join=true; | ||
set hive.convert.join.bucket.mapjoin.tez=true; | ||
|
||
CREATE TABLE tbl (foid string, part string, id string) CLUSTERED BY (id, part) INTO 64 BUCKETS; | ||
INSERT INTO tbl VALUES ('1234', 'PART_123', '1'), ('1235', 'PART_124', '2'); | ||
|
||
EXPLAIN | ||
SELECT * FROM tbl JOIN tbl tbl2 ON tbl.id = tbl2.id AND tbl.part = tbl2.part; | ||
SELECT * FROM tbl JOIN tbl tbl2 ON tbl.id = tbl2.id AND tbl.part = tbl2.part; |
112 changes: 112 additions & 0 deletions
112
ql/src/test/results/clientpositive/llap/bucketmapjoin14.q.out
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,112 @@ | ||
PREHOOK: query: CREATE TABLE tbl (foid string, part string, id string) CLUSTERED BY (id, part) INTO 64 BUCKETS | ||
PREHOOK: type: CREATETABLE | ||
PREHOOK: Output: database:default | ||
PREHOOK: Output: default@tbl | ||
POSTHOOK: query: CREATE TABLE tbl (foid string, part string, id string) CLUSTERED BY (id, part) INTO 64 BUCKETS | ||
POSTHOOK: type: CREATETABLE | ||
POSTHOOK: Output: database:default | ||
POSTHOOK: Output: default@tbl | ||
PREHOOK: query: INSERT INTO tbl VALUES ('1234', 'PART_123', '1'), ('1235', 'PART_124', '2') | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: _dummy_database@_dummy_table | ||
PREHOOK: Output: default@tbl | ||
POSTHOOK: query: INSERT INTO tbl VALUES ('1234', 'PART_123', '1'), ('1235', 'PART_124', '2') | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: _dummy_database@_dummy_table | ||
POSTHOOK: Output: default@tbl | ||
POSTHOOK: Lineage: tbl.foid SCRIPT [] | ||
POSTHOOK: Lineage: tbl.id SCRIPT [] | ||
POSTHOOK: Lineage: tbl.part SCRIPT [] | ||
PREHOOK: query: EXPLAIN | ||
SELECT * FROM tbl JOIN tbl tbl2 ON tbl.id = tbl2.id AND tbl.part = tbl2.part | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: default@tbl | ||
#### A masked pattern was here #### | ||
POSTHOOK: query: EXPLAIN | ||
SELECT * FROM tbl JOIN tbl tbl2 ON tbl.id = tbl2.id AND tbl.part = tbl2.part | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: default@tbl | ||
#### A masked pattern was here #### | ||
STAGE DEPENDENCIES: | ||
Stage-1 is a root stage | ||
Stage-0 depends on stages: Stage-1 | ||
|
||
STAGE PLANS: | ||
Stage: Stage-1 | ||
Tez | ||
#### A masked pattern was here #### | ||
Edges: | ||
Map 1 <- Map 2 (CUSTOM_EDGE) | ||
#### A masked pattern was here #### | ||
Vertices: | ||
Map 1 | ||
Map Operator Tree: | ||
TableScan | ||
alias: tbl | ||
filterExpr: (id is not null and part is not null) (type: boolean) | ||
Statistics: Num rows: 2 Data size: 530 Basic stats: COMPLETE Column stats: COMPLETE | ||
Filter Operator | ||
predicate: (id is not null and part is not null) (type: boolean) | ||
Statistics: Num rows: 2 Data size: 530 Basic stats: COMPLETE Column stats: COMPLETE | ||
Select Operator | ||
expressions: foid (type: string), part (type: string), id (type: string) | ||
outputColumnNames: _col0, _col1, _col2 | ||
Statistics: Num rows: 2 Data size: 530 Basic stats: COMPLETE Column stats: COMPLETE | ||
Map Join Operator | ||
condition map: | ||
Inner Join 0 to 1 | ||
keys: | ||
0 _col1 (type: string), _col2 (type: string) | ||
1 _col1 (type: string), _col2 (type: string) | ||
outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5 | ||
input vertices: | ||
1 Map 2 | ||
Statistics: Num rows: 2 Data size: 1060 Basic stats: COMPLETE Column stats: COMPLETE | ||
File Output Operator | ||
compressed: false | ||
Statistics: Num rows: 2 Data size: 1060 Basic stats: COMPLETE Column stats: COMPLETE | ||
table: | ||
input format: org.apache.hadoop.mapred.SequenceFileInputFormat | ||
output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat | ||
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe | ||
Execution mode: vectorized, llap | ||
LLAP IO: all inputs | ||
Map 2 | ||
Map Operator Tree: | ||
TableScan | ||
alias: tbl2 | ||
filterExpr: (id is not null and part is not null) (type: boolean) | ||
Statistics: Num rows: 2 Data size: 530 Basic stats: COMPLETE Column stats: COMPLETE | ||
Filter Operator | ||
predicate: (id is not null and part is not null) (type: boolean) | ||
Statistics: Num rows: 2 Data size: 530 Basic stats: COMPLETE Column stats: COMPLETE | ||
Select Operator | ||
expressions: foid (type: string), part (type: string), id (type: string) | ||
outputColumnNames: _col0, _col1, _col2 | ||
Statistics: Num rows: 2 Data size: 530 Basic stats: COMPLETE Column stats: COMPLETE | ||
Reduce Output Operator | ||
key expressions: _col1 (type: string), _col2 (type: string) | ||
null sort order: zz | ||
sort order: ++ | ||
Map-reduce partition columns: _col2 (type: string), _col1 (type: string) | ||
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. I verified that this list is inverted on the master branch, and the result would be empty.
|
||
Statistics: Num rows: 2 Data size: 530 Basic stats: COMPLETE Column stats: COMPLETE | ||
value expressions: _col0 (type: string) | ||
Execution mode: vectorized, llap | ||
LLAP IO: all inputs | ||
|
||
Stage: Stage-0 | ||
Fetch Operator | ||
limit: -1 | ||
Processor Tree: | ||
ListSink | ||
|
||
PREHOOK: query: SELECT * FROM tbl JOIN tbl tbl2 ON tbl.id = tbl2.id AND tbl.part = tbl2.part | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: default@tbl | ||
#### A masked pattern was here #### | ||
POSTHOOK: query: SELECT * FROM tbl JOIN tbl tbl2 ON tbl.id = tbl2.id AND tbl.part = tbl2.part | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: default@tbl | ||
#### A masked pattern was here #### | ||
1234 PART_123 1 1234 PART_123 1 | ||
1235 PART_124 2 1235 PART_124 2 |
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.
I verified that this list is inverted on the master branch, and the result would be empty.