This is an automated email from the ASF dual-hosted git repository.
dkuzmenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new 73515e43b90 HIVE-26018: Produce the same result for UNIQUEJOIN
regardless of execution engine (Seonggon Namgung, reviewed by Denys Kuzmenko,
Krisztian Kasa)
73515e43b90 is described below
commit 73515e43b904748bb8cb85c7ad620df46c90cfe7
Author: seonggon <[email protected]>
AuthorDate: Fri Jun 28 17:41:34 2024 +0900
HIVE-26018: Produce the same result for UNIQUEJOIN regardless of execution
engine (Seonggon Namgung, reviewed by Denys Kuzmenko, Krisztian Kasa)
Closes #5270
---
.../hadoop/hive/ql/exec/CommonJoinOperator.java | 2 +
ql/src/test/queries/clientpositive/uniquejoin2.q | 15 ++
.../results/clientpositive/llap/uniquejoin2.q.out | 222 +++++++++++++++++++++
3 files changed, 239 insertions(+)
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/CommonJoinOperator.java
b/ql/src/java/org/apache/hadoop/hive/ql/exec/CommonJoinOperator.java
index b0b860e16d3..58ae7f3ef42 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/CommonJoinOperator.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/CommonJoinOperator.java
@@ -949,6 +949,8 @@ public abstract class CommonJoinOperator<T extends
JoinDesc> extends
if (!alw.hasRows()) {
alw.addRow(dummyObj[i]);
hasNulls = true;
+ } else if (alw.isSingleRow() && alw.rowIter().first() == dummyObj[i]) {
+ hasNulls = true;
} else if (condn[i].getPreserved()) {
preserve = true;
}
diff --git a/ql/src/test/queries/clientpositive/uniquejoin2.q
b/ql/src/test/queries/clientpositive/uniquejoin2.q
new file mode 100644
index 00000000000..f65a8363255
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/uniquejoin2.q
@@ -0,0 +1,15 @@
+-- SORT_QUERY_RESULTS
+
+CREATE TABLE T1_n1x(key STRING, val STRING) STORED AS orc;
+CREATE TABLE T2_n1x(key STRING, val STRING) STORED AS orc;
+
+insert into T1_n1x values('aaa', '111'),('bbb', '222'),('ccc', '333');
+insert into T2_n1x values('aaa', '111'),('ddd', '444'),('ccc', '333');
+
+EXPLAIN
+SELECT a.key, b.key FROM UNIQUEJOIN PRESERVE T1_n1x a (a.key), PRESERVE
T2_n1x b (b.key);
+SELECT a.key, b.key FROM UNIQUEJOIN PRESERVE T1_n1x a (a.key), PRESERVE
T2_n1x b (b.key);
+
+EXPLAIN
+SELECT a.key, b.key FROM UNIQUEJOIN T1_n1x a (a.key), T2_n1x b (b.key);
+SELECT a.key, b.key FROM UNIQUEJOIN T1_n1x a (a.key), T2_n1x b (b.key);
diff --git a/ql/src/test/results/clientpositive/llap/uniquejoin2.q.out
b/ql/src/test/results/clientpositive/llap/uniquejoin2.q.out
new file mode 100644
index 00000000000..915fc270554
--- /dev/null
+++ b/ql/src/test/results/clientpositive/llap/uniquejoin2.q.out
@@ -0,0 +1,222 @@
+PREHOOK: query: CREATE TABLE T1_n1x(key STRING, val STRING) STORED AS orc
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@T1_n1x
+POSTHOOK: query: CREATE TABLE T1_n1x(key STRING, val STRING) STORED AS orc
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@T1_n1x
+PREHOOK: query: CREATE TABLE T2_n1x(key STRING, val STRING) STORED AS orc
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@T2_n1x
+POSTHOOK: query: CREATE TABLE T2_n1x(key STRING, val STRING) STORED AS orc
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@T2_n1x
+PREHOOK: query: insert into T1_n1x values('aaa', '111'),('bbb', '222'),('ccc',
'333')
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: default@t1_n1x
+POSTHOOK: query: insert into T1_n1x values('aaa', '111'),('bbb',
'222'),('ccc', '333')
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: default@t1_n1x
+POSTHOOK: Lineage: t1_n1x.key SCRIPT []
+POSTHOOK: Lineage: t1_n1x.val SCRIPT []
+PREHOOK: query: insert into T2_n1x values('aaa', '111'),('ddd', '444'),('ccc',
'333')
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: default@t2_n1x
+POSTHOOK: query: insert into T2_n1x values('aaa', '111'),('ddd',
'444'),('ccc', '333')
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: default@t2_n1x
+POSTHOOK: Lineage: t2_n1x.key SCRIPT []
+POSTHOOK: Lineage: t2_n1x.val SCRIPT []
+PREHOOK: query: EXPLAIN
+SELECT a.key, b.key FROM UNIQUEJOIN PRESERVE T1_n1x a (a.key), PRESERVE
T2_n1x b (b.key)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t1_n1x
+PREHOOK: Input: default@t2_n1x
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a.key, b.key FROM UNIQUEJOIN PRESERVE T1_n1x a (a.key), PRESERVE
T2_n1x b (b.key)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t1_n1x
+POSTHOOK: Input: default@t2_n1x
+#### 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:
+ Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 3 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+ Vertices:
+ Map 1
+ Map Operator Tree:
+ TableScan
+ alias: a
+ Statistics: Num rows: 3 Data size: 261 Basic stats: COMPLETE
Column stats: COMPLETE
+ Reduce Output Operator
+ key expressions: key (type: string)
+ null sort order: z
+ sort order: +
+ Map-reduce partition columns: key (type: string)
+ Statistics: Num rows: 3 Data size: 261 Basic stats:
COMPLETE Column stats: COMPLETE
+ Execution mode: vectorized, llap
+ LLAP IO: all inputs
+ Map 3
+ Map Operator Tree:
+ TableScan
+ alias: b
+ Statistics: Num rows: 3 Data size: 261 Basic stats: COMPLETE
Column stats: COMPLETE
+ Reduce Output Operator
+ key expressions: key (type: string)
+ null sort order: z
+ sort order: +
+ Map-reduce partition columns: key (type: string)
+ Statistics: Num rows: 3 Data size: 261 Basic stats:
COMPLETE Column stats: COMPLETE
+ Execution mode: vectorized, llap
+ LLAP IO: all inputs
+ Reducer 2
+ Execution mode: llap
+ Reduce Operator Tree:
+ Merge Join Operator
+ condition map:
+ Unique Join 0 to 0
+ Unique Join 0 to 0
+ keys:
+ 0 key (type: string)
+ 1 key (type: string)
+ outputColumnNames: _col0, _col6
+ Statistics: Num rows: 3 Data size: 522 Basic stats: COMPLETE
Column stats: COMPLETE
+ Select Operator
+ expressions: _col0 (type: string), _col6 (type: string)
+ outputColumnNames: _col0, _col1
+ Statistics: Num rows: 3 Data size: 522 Basic stats: COMPLETE
Column stats: COMPLETE
+ File Output Operator
+ compressed: false
+ Statistics: Num rows: 3 Data size: 522 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
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: -1
+ Processor Tree:
+ ListSink
+
+PREHOOK: query: SELECT a.key, b.key FROM UNIQUEJOIN PRESERVE T1_n1x a (a.key),
PRESERVE T2_n1x b (b.key)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t1_n1x
+PREHOOK: Input: default@t2_n1x
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a.key, b.key FROM UNIQUEJOIN PRESERVE T1_n1x a
(a.key), PRESERVE T2_n1x b (b.key)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t1_n1x
+POSTHOOK: Input: default@t2_n1x
+#### A masked pattern was here ####
+NULL ddd
+aaa aaa
+bbb NULL
+ccc ccc
+PREHOOK: query: EXPLAIN
+SELECT a.key, b.key FROM UNIQUEJOIN T1_n1x a (a.key), T2_n1x b (b.key)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t1_n1x
+PREHOOK: Input: default@t2_n1x
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a.key, b.key FROM UNIQUEJOIN T1_n1x a (a.key), T2_n1x b (b.key)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t1_n1x
+POSTHOOK: Input: default@t2_n1x
+#### 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:
+ Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 3 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+ Vertices:
+ Map 1
+ Map Operator Tree:
+ TableScan
+ alias: a
+ Statistics: Num rows: 3 Data size: 261 Basic stats: COMPLETE
Column stats: COMPLETE
+ Reduce Output Operator
+ key expressions: key (type: string)
+ null sort order: z
+ sort order: +
+ Map-reduce partition columns: key (type: string)
+ Statistics: Num rows: 3 Data size: 261 Basic stats:
COMPLETE Column stats: COMPLETE
+ Execution mode: vectorized, llap
+ LLAP IO: all inputs
+ Map 3
+ Map Operator Tree:
+ TableScan
+ alias: b
+ Statistics: Num rows: 3 Data size: 261 Basic stats: COMPLETE
Column stats: COMPLETE
+ Reduce Output Operator
+ key expressions: key (type: string)
+ null sort order: z
+ sort order: +
+ Map-reduce partition columns: key (type: string)
+ Statistics: Num rows: 3 Data size: 261 Basic stats:
COMPLETE Column stats: COMPLETE
+ Execution mode: vectorized, llap
+ LLAP IO: all inputs
+ Reducer 2
+ Execution mode: llap
+ Reduce Operator Tree:
+ Merge Join Operator
+ condition map:
+ Unique Join 0 to 0
+ Unique Join 0 to 0
+ keys:
+ 0 key (type: string)
+ 1 key (type: string)
+ outputColumnNames: _col0, _col6
+ Statistics: Num rows: 3 Data size: 522 Basic stats: COMPLETE
Column stats: COMPLETE
+ Select Operator
+ expressions: _col0 (type: string), _col6 (type: string)
+ outputColumnNames: _col0, _col1
+ Statistics: Num rows: 3 Data size: 522 Basic stats: COMPLETE
Column stats: COMPLETE
+ File Output Operator
+ compressed: false
+ Statistics: Num rows: 3 Data size: 522 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
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: -1
+ Processor Tree:
+ ListSink
+
+PREHOOK: query: SELECT a.key, b.key FROM UNIQUEJOIN T1_n1x a (a.key), T2_n1x b
(b.key)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t1_n1x
+PREHOOK: Input: default@t2_n1x
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a.key, b.key FROM UNIQUEJOIN T1_n1x a (a.key), T2_n1x
b (b.key)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t1_n1x
+POSTHOOK: Input: default@t2_n1x
+#### A masked pattern was here ####
+aaa aaa
+ccc ccc