github-actions[bot] commented on code in PR #69068:
URL: https://github.com/apache/doris/pull/69068#discussion_r4279158829
##########
fe/fe-core/src/main/java/org/apache/doris/planner/HashDistributionPruner.java:
##########
@@ -102,18 +102,19 @@ public Collection<Long> prune(int columnId, PartitionKey
hashKey, int complex) {
// return all subPartition
return getAllTabletIds();
}
+ // An equality bound is more selective than an IN predicate on the
same column.
+ // Keep the remaining predicates for row filtering, including
contradictory IN values.
+ if (filter.lowerBoundInclusive && filter.upperBoundInclusive
+ && filter.lowerBound != null && filter.upperBound != null
+ && 0 == filter.lowerBound.compareLiteral(filter.upperBound)) {
Review Comment:
[P2] Require exact distribution values before preferring bounds
`compareLiteral() == 0` does not establish an identical distribution value
for strings: `'a'` and `'a\0b'` compare equal, but hash to buckets 3 and 17
with 32 buckets. For example, with the supported
`disable_nereids_rules='REWRITE_FILTER_EXPRESSION,CONSTANT_PROPAGATION,INFER_PREDICATES'`
setting, this reduced plan retains all three predicates:
```text
Filter(k >= 'a' AND k <= 'a\0b' AND k IN ('a', 'a\0b'))
OlapScan(VARCHAR k, HASH(k), 32 buckets)
```
`ExpressionColumnFilterConverter` supplies those distinct inclusive bounds
plus the IN list. This branch now selects only the `'a'` tablet, omitting the
matching `'a\0b'` row; previously IN enumeration selected both tablets.
Retaining scan predicates cannot recover a skipped row. Require exact typed
value identity before overriding IN enumeration and add a NUL-prefix range/IN
regression. `LiteralExpr.equals()` also delegates to `compareLiteral()`, so it
would not fix this case.
--
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]