jcamachor commented on a change in pull request #1811:
URL: https://github.com/apache/hive/pull/1811#discussion_r563973915



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/ppd/OpProcFactory.java
##########
@@ -712,14 +714,47 @@ private void applyFilterTransitivity(JoinOperator join, 
int targetPos, OpWalkerI
           if (!sourceAliases.contains(entry.getKey())) {
             continue;
           }
+
+          Set<ExprNodeColumnDesc> columnsInPredicates = null;
+          if (HiveConf.getBoolVar(owi.getParseContext().getConf(),
+                  HiveConf.ConfVars.HIVEPPD_RECOGNIZE_COLUMN_EQUALITIES)) {
+            columnsInPredicates = owi.getColumnsInPredicates().get(source);
+            if (columnsInPredicates == null) {
+              columnsInPredicates = 
collectColumnsInPredicates(entry.getValue());
+              owi.getColumnsInPredicates().put(source, columnsInPredicates);
+            }
+          }
+
           for (ExprNodeDesc predicate : entry.getValue()) {
             ExprNodeDesc backtrack = ExprNodeDescUtils.backtrack(predicate, 
join, source);
             if (backtrack == null) {
               continue;
             }
             ExprNodeDesc replaced = ExprNodeDescUtils.replace(backtrack, 
sourceKeys, targetKeys);
             if (replaced == null) {
-              continue;
+              if (!HiveConf.getBoolVar(owi.getParseContext().getConf(),

Review comment:
       Extract the property value into a variable before entering in the loop 
(~L700).

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/ppd/OpProcFactory.java
##########
@@ -712,14 +714,47 @@ private void applyFilterTransitivity(JoinOperator join, 
int targetPos, OpWalkerI
           if (!sourceAliases.contains(entry.getKey())) {
             continue;
           }
+
+          Set<ExprNodeColumnDesc> columnsInPredicates = null;
+          if (HiveConf.getBoolVar(owi.getParseContext().getConf(),

Review comment:
       Extract the property value into a variable before entering in the loop 
(~L700).

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/ppd/OpWalkerInfo.java
##########
@@ -39,11 +43,15 @@
     opToPushdownPredMap;
   private final ParseContext pGraphContext;
   private final List<FilterOperator> candidateFilterOps;
+  private final Map<Operator<?>, Set<ExprNodeColumnDesc>> columnsInPredicates;

Review comment:
       Can we add comments about these data structures and what they will hold?

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/ppd/OpProcFactory.java
##########
@@ -728,6 +763,166 @@ private void applyFilterTransitivity(JoinOperator join, 
int targetPos, OpWalkerI
         }
       }
     }
+
+    private Set<ExprNodeColumnDesc> 
collectColumnsInPredicates(List<ExprNodeDesc> predicates) {

Review comment:
       Can we add a few high level comments to these new private methods 
describing what they do?

##########
File path: common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
##########
@@ -2461,6 +2461,10 @@ private static void 
populateLlapDaemonVarsSet(Set<String> llapDaemonVarsSetLocal
         "Whether to enable predicate pushdown through windowing"),
     HIVEPPDRECOGNIZETRANSITIVITY("hive.ppd.recognizetransivity", true,
         "Whether to transitively replicate predicate filters over equijoin 
conditions."),
+    
HIVEPPD_RECOGNIZE_COLUMN_EQUALITIES("hive.ppd.recognize.column.equalities", 
true,
+        "When hive.ppd.recognizetransivity is true Whether traverse join 
branches to discover equal columns based" +
+                " on equijoin keys and try to substitute equal columns to 
predicates " +
+                "and push down to the other branch."),
     HIVEPPDREMOVEDUPLICATEFILTERS("hive.ppd.remove.duplicatefilters", true,

Review comment:
       "Whether we should traverse the join branches to discover transitive 
propagation opportunities over equijoin conditions. \n" +
                   "Requires hive.ppd.recognizetransivity to be set to true."




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



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

Reply via email to