konstantinb commented on code in PR #6505:
URL: https://github.com/apache/hive/pull/6505#discussion_r4475461858
##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java:
##########
@@ -558,18 +558,25 @@ private long evaluateInExpr(Statistics stats,
ExprNodeDesc pred, long currNumRow
factor *= children.size() - 1;
}
for (int i = 0; i < columnStats.size(); i++) {
- long dvs = columnStats.get(i) == null ? 0 :
columnStats.get(i).getCountDistint();
+ ColStatistics cs = columnStats.get(i);
+ long dvs = cs == null ? -1L : cs.getCountDistint();
if (dvs == 0) {
- factor *= 0.5;
- continue;
+ // verified zero distinct values: IN cannot match any row
+ factor = 0;
+ break;
Review Comment:
Keeping the clamp is intentional: `hive.stats.filter.in.min.ratio` is an
opt-in floor for IN estimates without a usable value range, and a stored NDV of
0 is the kind of estimate it protects against.
[17bccf8](https://github.com/apache/hive/pull/6505/commits/17bccf8d22) rewrites
the comment that overstated this and pins the interaction in
`TestStatsRulesProcFactory`.
--
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]