vdiravka commented on a change in pull request #1568: DRILL-6878: Use 
DrillPushRowKeyJoinToScan rule on DrillJoin pattern to o account for 
DrillSemiJoin
URL: https://github.com/apache/drill/pull/1568#discussion_r240958295
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/RowKeyJoinRel.java
 ##########
 @@ -50,20 +66,72 @@ public RowKeyJoinRel(RelOptCluster cluster, RelTraitSet 
traits, RelNode left, Re
 
   @Override
   public RowKeyJoinRel copy(RelTraitSet traitSet, RexNode condition, RelNode 
left, RelNode right, JoinRelType joinType,
-      boolean semiJoinDone) {
-    return new RowKeyJoinRel(getCluster(), traitSet, left, right, condition, 
joinType);
+      boolean semiJoin) {
+    return new RowKeyJoinRel(getCluster(), traitSet, left, right, condition, 
joinType, semiJoin);
   }
 
   @Override
   public LogicalOperator implement(DrillImplementor implementor) {
     return super.implement(implementor);
   }
 
+  /**
+   * Returns whether this RowKeyJoin represents a {@link 
org.apache.calcite.rel.core.SemiJoin}
+   * @return true if join represents a {@link 
org.apache.calcite.rel.core.SemiJoin}, false otherwise.
+   */
+  public boolean isSemiJoin() {
+    return isSemiJoin;
+  }
+
+  @Override
+  public RelDataType deriveRowType() {
+    return SqlValidatorUtil.deriveJoinRowType(
+            left.getRowType(),
+            isSemiJoin() ? null : right.getRowType(),
+            JoinRelType.INNER,
+            getCluster().getTypeFactory(),
+            null,
+            ImmutableList.of());
+  }
+
   public static RowKeyJoinRel convert(Join join, ConversionContext context) 
throws InvalidRelException {
     Pair<RelNode, RelNode> inputs = getJoinInputs(join, context);
     RexNode rexCondition = getJoinCondition(join, context);
     RowKeyJoinRel joinRel = new RowKeyJoinRel(context.getCluster(), 
context.getLogicalTraits(),
         inputs.left, inputs.right, rexCondition, join.getJoinType());
     return joinRel;
   }
+
+  @Override public boolean isValid(Litmus litmus, Context context) {
 
 Review comment:
   `both both`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to