use of org.apache.drill.exec.physical.config.HashJoinPOP in project drill by apache.
the class HashJoinPrel method getHashJoinPop.
private PhysicalOperator getHashJoinPop(PhysicalPlanCreator creator, RelNode left, RelNode right, List<Integer> leftKeys, List<Integer> rightKeys) throws IOException {
final List<String> fields = getRowType().getFieldNames();
assert isUnique(fields);
final List<String> leftFields = left.getRowType().getFieldNames();
final List<String> rightFields = right.getRowType().getFieldNames();
PhysicalOperator leftPop = ((Prel) left).getPhysicalOperator(creator);
PhysicalOperator rightPop = ((Prel) right).getPhysicalOperator(creator);
JoinRelType jtype = this.getJoinType();
List<JoinCondition> conditions = Lists.newArrayList();
buildJoinConditions(conditions, leftFields, rightFields, leftKeys, rightKeys);
HashJoinPOP hjoin = new HashJoinPOP(leftPop, rightPop, conditions, jtype);
return creator.addMetadata(this, hjoin);
}
use of org.apache.drill.exec.physical.config.HashJoinPOP in project drill by axbaretto.
the class TestNullInputMiniPlan method testHashJoinRightEmpty.
@Test
public void testHashJoinRightEmpty() throws Exception {
List<String> leftJsonBatches = Lists.newArrayList("[{\"a\": 50, \"b\" : 10 }]");
RecordBatch leftScan = new JsonScanBuilder().jsonBatches(leftJsonBatches).columnsToRead("a", "b").build();
RecordBatch right = createScanBatchFromJson(SINGLE_EMPTY_JSON);
RecordBatch joinBatch = new PopBuilder().physicalOperator(new HashJoinPOP(null, null, Lists.newArrayList(joinCond("a", "EQUALS", "a2")), JoinRelType.INNER)).addInput(leftScan).addInput(right).build();
BatchSchema expectedSchema = new SchemaBuilder().addNullable("a", TypeProtos.MinorType.BIGINT).addNullable("b", TypeProtos.MinorType.BIGINT).withSVMode(BatchSchema.SelectionVectorMode.NONE).build();
new MiniPlanTestBuilder().root(joinBatch).expectSchema(expectedSchema).expectZeroRow(true).go();
}
use of org.apache.drill.exec.physical.config.HashJoinPOP in project drill by axbaretto.
the class TestNullInputMiniPlan method testRightHashJoinEmptyBoth.
@Test
public void testRightHashJoinEmptyBoth() throws Exception {
final PhysicalOperator join = new HashJoinPOP(null, null, Lists.newArrayList(joinCond("a", "EQUALS", "b")), JoinRelType.RIGHT);
testTwoInputNullBatchHandling(join);
}
use of org.apache.drill.exec.physical.config.HashJoinPOP in project drill by axbaretto.
the class TestNullInputMiniPlan method testHashJoinEmptyBoth.
@Test
public void testHashJoinEmptyBoth() throws Exception {
final PhysicalOperator join = new HashJoinPOP(null, null, Lists.newArrayList(joinCond("a", "EQUALS", "b")), JoinRelType.INNER);
testTwoInputNullBatchHandling(join);
}
use of org.apache.drill.exec.physical.config.HashJoinPOP in project drill by axbaretto.
the class TestNullInputMiniPlan method testLeftHashJoinLeftEmpty.
@Test
public void testLeftHashJoinLeftEmpty() throws Exception {
RecordBatch left = createScanBatchFromJson(SINGLE_EMPTY_JSON);
List<String> rightJsonBatches = Lists.newArrayList("[{\"a\": 50, \"b\" : 10 }]");
RecordBatch rightScan = new JsonScanBuilder().jsonBatches(rightJsonBatches).columnsToRead("a", "b").build();
RecordBatch joinBatch = new PopBuilder().physicalOperator(new HashJoinPOP(null, null, Lists.newArrayList(joinCond("a", "EQUALS", "a2")), JoinRelType.LEFT)).addInput(left).addInput(rightScan).build();
BatchSchema expectedSchema = new SchemaBuilder().addNullable("a", TypeProtos.MinorType.BIGINT).addNullable("b", TypeProtos.MinorType.BIGINT).withSVMode(BatchSchema.SelectionVectorMode.NONE).build();
new MiniPlanTestBuilder().root(joinBatch).expectSchema(expectedSchema).expectZeroRow(true).go();
}
Aggregations