gparai commented on a change in pull request #1744: Drill 7148 - Join order, 
multi-col ndv and aggregate rowcount fixes for TPCH queries
URL: https://github.com/apache/drill/pull/1744#discussion_r275195168
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/planner/cost/DrillRelMdDistinctRowCount.java
 ##########
 @@ -229,4 +321,42 @@ public Double getDistinctRowCount(DrillJoinRelBase 
joinRel, RelMetadataQuery mq,
     }
     return RelMdUtil.numDistinctVals(distRowCount, mq.getRowCount(joinRel));
   }
+
+  private ImmutableBitSet getSingleGbyKey(ImmutableBitSet groupKey, int idx) {
+    if (groupKey.get(idx)) {
+      return ImmutableBitSet.builder().set(idx, idx+1).build();
+    } else {
+      return null;
+    }
+  }
+
+  private double getPredSelectivityContainingInputRef(RexNode predicate, int 
inputRef,
+      RelMetadataQuery mq, TableScan scan) {
+    if (predicate instanceof RexCall) {
+      if (predicate.getKind() == SqlKind.AND) {
+        double sel, andSel = 1.0;
+        for (RexNode op : ((RexCall) predicate).getOperands()) {
+          sel = getPredSelectivityContainingInputRef(op, inputRef, mq, scan);
+          andSel *= sel > 0 ? sel : 1.0;
 
 Review comment:
   Simplified it to avoid confusion

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

Reply via email to