konstantinb commented on code in PR #6505:
URL: https://github.com/apache/hive/pull/6505#discussion_r4701604135
##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java:
##########
@@ -2249,14 +2276,15 @@ private long calculateUnmatchedRowsForOuter(HiveConf
conf, long inputRowCount,
distinctVal = StatsUtils.addWithExpDecay(distinctVals);
}
}
- // If we have a greater number of unmatched values than number of
distinct values,
- // we just return the number of rows in the input as we can assume there
are no
- // matches
- if (distinctUnmatched >= distinctVal) {
+ // distinctVal <= 0 covers unknown (<0) and verified-zero (==0) cases;
the latter means
+ // no key value matches anything, so every input row is unmatched in an
outer join.
+ // distinctUnmatched < 0 (unknown) is treated conservatively the same
way.
+ // If unmatched >= distinctVal, all rows can be assumed unmatched.
+ if (distinctVal <= 0 || distinctUnmatched < 0 || distinctUnmatched >=
distinctVal) {
Review Comment:
Agreed, applied in
[ecb61df](https://github.com/apache/hive/pull/6505/commits/ecb61df3ac). After
`distinctUnmatched < 0` returns, `distinctUnmatched >= 0`, so
`distinctUnmatched >= distinctVal` already covers `distinctVal <= 0`. I also
rewrote the comment above the condition so it no longer describes the removed
test. No behaviour change; the existing cases for `distinctVal` -1 and 0 still
return the input row count.
--
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]