gianm commented on a change in pull request #9111: Add HashJoinSegment, a 
virtual segment for joins.
URL: https://github.com/apache/druid/pull/9111#discussion_r367613419
 
 

 ##########
 File path: 
processing/src/main/java/org/apache/druid/segment/join/JoinConditionAnalysis.java
 ##########
 @@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.segment.join;
+
+import com.google.common.base.Preconditions;
+import org.apache.druid.java.util.common.Pair;
+import org.apache.druid.math.expr.Expr;
+import org.apache.druid.math.expr.ExprMacroTable;
+import org.apache.druid.math.expr.Exprs;
+import org.apache.druid.math.expr.Parser;
+import org.apache.druid.query.expression.ExprUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+
+/**
+ * Represents analysis of a join condition.
+ *
+ * Each condition is decomposed into "equiConditions" and "nonEquiConditions".
+ *
+ * 1) The equiConditions are of the form ExpressionOfLeft = ColumnFromRight. 
The right-hand part cannot be an expression
+ * because we use this analysis to determine if we can perform the join using 
hashtables built off right-hand-side
+ * columns.
+ *
+ * 2) The nonEquiConditions are other conditions that should also be ANDed 
together
+ *
+ * All of these conditions are ANDed together to get the overall condition.
+ */
+public class JoinConditionAnalysis
+{
+  private final String originalExpression;
+  private final List<Equality> equiConditions;
+  private final List<Expr> nonEquiConditions;
+
+  private JoinConditionAnalysis(
+      final String originalExpression,
+      final List<Equality> equiConditions,
+      final List<Expr> nonEquiConditions
+  )
+  {
+    this.originalExpression = Preconditions.checkNotNull(originalExpression, 
"originalExpression");
+    this.equiConditions = equiConditions;
+    this.nonEquiConditions = nonEquiConditions;
+  }
+
+  public static JoinConditionAnalysis forExpression(
+      final String condition,
 
 Review comment:
   Yes, and that's because the way to think about the prefixes is that they 
aren't table names (which might be present or not), they are column name 
prefixes. They are mandatory.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

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

Reply via email to