danny0405 commented on a change in pull request #1157: [CALCITE-2969] Improve 
design of join-like relational expressions
URL: https://github.com/apache/calcite/pull/1157#discussion_r285322574
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/rel/core/JoinRelType.java
 ##########
 @@ -94,6 +150,37 @@ public JoinRelType cancelNullsOnRight() {
       return this;
     }
   }
+
+  /** Transform this JoinRelType to CorrelateJoinType. **/
+  public CorrelateJoinType toLinq4j() {
+    switch (this) {
+    case INNER:
+      return CorrelateJoinType.INNER;
+    case LEFT:
+      return CorrelateJoinType.LEFT;
+    case SEMI:
+      return CorrelateJoinType.SEMI;
+    case ANTI:
+      return CorrelateJoinType.ANTI;
+    }
+    throw new IllegalStateException(
+        "Unable to convert " + this + " to CorrelateJoinType");
+  }
+
+  public boolean projectsRight() {
+    switch (this) {
+    case INNER:
+    case LEFT:
+    case RIGHT:
+    case FULL:
+      return true;
+    case SEMI:
+    case ANTI:
+      return false;
+    }
+    throw new IllegalStateException(
 
 Review comment:
   @zabetak Oops, i mistaken it, but if i remove the `throw` java compiler will 
complains error. We have 2 choice:
   1. throw exception (cause we may extend the join type in future)
   2. return a default value (i don't think we actually can have the default 
here)
   
   So, 1 seems more acceptable. What do you think ?

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


With regards,
Apache Git Services

Reply via email to