kgyrtkirk commented on code in PR #17039:
URL: https://github.com/apache/druid/pull/17039#discussion_r1759377204


##########
sql/src/main/java/org/apache/druid/sql/calcite/planner/querygen/DruidQueryGenerator.java:
##########
@@ -133,6 +168,42 @@ private interface Vertex
     SourceDesc unwrapSourceDesc();
   }
 
+  enum JoinSupportTweaks
+  {
+    NONE,
+    LEFT,
+    RIGHT;
+
+    static JoinSupportTweaks analyze(DruidNodeStack stack)
+    {
+      if (stack.size() < 2) {
+        return NONE;
+      }
+      DruidLogicalNode possibleJoin = stack.get(stack.size() - 2);
+      if (!(possibleJoin instanceof DruidJoin)) {
+        return NONE;
+      }
+      if (stack.operandIndexStack.get(stack.size() - 1) == 1) {
+        return RIGHT;
+      } else {
+        return LEFT;
+      }
+    }

Review Comment:
   part of the problem was that a `Join` may have the *same* subtree on both 
left and right - which mandated the need for the `operandIndex`.
   
   By adding some usefull methods to `DruidNodeStack` ; these magic numbers and 
substraction have more or less disappeared :)
   
   I don't think `JoinSupportTweaks` will be a long lived `enum` ; I just 
haven't figured it out yet how many more details I'll need later - I have a 
feeling that later this will become something like: `VertexOptions` with a set 
of booleans/etc....
   



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to