This is an automated email from the ASF dual-hosted git repository.
rymarm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git
The following commit(s) were added to refs/heads/master by this push:
new ce7874479c DRILL-8513: Right Hash Join with empty left table ruturns 0
result (#2952)
ce7874479c is described below
commit ce7874479cee9ac0a60bb4ea24af090212df0ece
Author: Maksym Rymar <[email protected]>
AuthorDate: Mon Oct 21 12:22:41 2024 +0300
DRILL-8513: Right Hash Join with empty left table ruturns 0 result (#2952)
---
.../physical/impl/join/HashJoinProbeTemplate.java | 4 +--
.../exec/physical/impl/join/TestHashJoin.java | 5 +++
.../join/hj_right_outer_empty_left_input.json | 42 ++++++++++++++++++++++
3 files changed, 49 insertions(+), 2 deletions(-)
diff --git
a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinProbeTemplate.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinProbeTemplate.java
index 43e221a246..f6e7978b08 100644
---
a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinProbeTemplate.java
+++
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinProbeTemplate.java
@@ -42,13 +42,13 @@ public class HashJoinProbeTemplate extends
ProbeTemplate<HashJoinPOP> {
IterOutcome leftStartState, HashPartition[]
partitions, int cycleNum,
VectorContainer container,
AbstractHashBinaryRecordBatch.SpilledPartition[] spilledInners,
boolean buildSideIsEmpty, int numPartitions,
int rightHVColPosition) throws SchemaChangeException {
- super.setup(probeBatch, leftStartState, partitions, cycleNum, container,
spilledInners,
- buildSideIsEmpty, numPartitions);
this.outgoingBatch = outgoing;
this.joinType = joinRelType;
this.joinControl = new
JoinControl(outgoing.getPopConfig().getJoinControl());
this.semiJoin = semiJoin;
this.numberOfBuildSideColumns = semiJoin ? 0 : rightHVColPosition; //
position (0 based) of added column == #columns
+ super.setup(probeBatch, leftStartState, partitions, cycleNum, container,
spilledInners,
+ buildSideIsEmpty, numPartitions);
}
@Override
diff --git
a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestHashJoin.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestHashJoin.java
index 29cc31938f..b4d4c4cc99 100644
---
a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestHashJoin.java
+++
b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestHashJoin.java
@@ -105,6 +105,11 @@ public class TestHashJoin extends PopUnitTestBase {
testHJMockScanCommon("/join/hj_left_outer_multi_batch.json", 100000);
}
+ @Test
+ public void emptyLeftSideOnRightJoin() throws Throwable {
+ testHJMockScanCommon("/join/hj_right_outer_empty_left_input.json", 5);
+ }
+
@Test
public void simpleEqualityJoin() throws Throwable {
// Function checks hash join with single equality condition
diff --git
a/exec/java-exec/src/test/resources/join/hj_right_outer_empty_left_input.json
b/exec/java-exec/src/test/resources/join/hj_right_outer_empty_left_input.json
new file mode 100644
index 0000000000..f319effb8e
--- /dev/null
+++
b/exec/java-exec/src/test/resources/join/hj_right_outer_empty_left_input.json
@@ -0,0 +1,42 @@
+{
+ head:{
+ type:"APACHE_DRILL_PHYSICAL",
+ version:"1",
+ generator:{
+ type:"manual"
+ }
+ },
+ graph:[
+ {
+ @id:1,
+ pop:"mock-sub-scan",
+ entries:[
+ {records: 0, types: [
+ {name: "id", type: "INT", mode: "REQUIRED"}
+ ]}
+ ]
+ },
+ {
+ @id:2,
+ pop:"mock-sub-scan",
+ entries:[
+ {records: 5, types: [
+ {name: "id1", type: "INT", mode: "REQUIRED"}
+ ]}
+ ]
+ },
+ {
+ @id: 3,
+ left: 1,
+ right: 2,
+ pop: "hash-join",
+ joinType: "RIGHT",
+ conditions: [ {relationship: "==", left: "id", right: "id1"} ]
+ },
+ {
+ @id: 4,
+ child: 3,
+ pop: "screen"
+ }
+ ]
+}