zabetak commented on a change in pull request #1325:
URL: https://github.com/apache/hive/pull/1325#discussion_r466368067
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/parse/TezCompiler.java
##########
@@ -1737,35 +1737,46 @@ private static double getBloomFilterBenefit(
}
}
- // Selectivity: key cardinality of semijoin / domain cardinality
- // Benefit (rows filtered from ts): (1 - selectivity) * # ts rows
- double selectivity = selKeyCardinality / (double) keyDomainCardinality;
- selectivity = Math.min(selectivity, 1);
- benefit = tsRows * (1 - selectivity);
-
if (LOG.isDebugEnabled()) {
- LOG.debug("BloomFilter benefit for " + selCol + " to " + tsCol
- + ", selKeyCardinality=" + selKeyCardinality
- + ", tsKeyCardinality=" + tsKeyCardinality
- + ", tsRows=" + tsRows
- + ", keyDomainCardinality=" + keyDomainCardinality);
- LOG.debug("SemiJoin key selectivity=" + selectivity
- + ", benefit=" + benefit);
+ LOG.debug("BloomFilter selectivity for " + selCol + " to " + tsCol + ",
selKeyCardinality=" + selKeyCardinality
+ + ", tsKeyCardinality=" + tsKeyCardinality + ",
keyDomainCardinality=" + keyDomainCardinality);
}
+ // Selectivity: key cardinality of semijoin / domain cardinality
+ return selKeyCardinality / (double) keyDomainCardinality;
+ }
- return benefit;
+ private static double getBloomFilterBenefit(
+ SelectOperator sel, List<ExprNodeDesc> selExpr,
+ Statistics filStats, List<ExprNodeDesc> tsExpr) {
+ if (sel.getStatistics() == null || filStats == null) {
+ LOG.debug("No stats available to compute BloomFilter benefit");
+ return -1;
+ }
+ double selectivity = 0.0;
+ for (int i = 0; i < tsExpr.size(); i++) {
+ selectivity = Math.max(selectivity, getBloomFilterSelectivity(sel,
selExpr.get(i), filStats, tsExpr.get(i)));
Review comment:
You are right, I was the one confused. I applied the change along with
some doc.
----------------------------------------------------------------
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]