github-actions[bot] commented on code in PR #64026:
URL: https://github.com/apache/doris/pull/64026#discussion_r3417892679
##########
fe/fe-catalog/src/main/java/org/apache/doris/analysis/IntLiteral.java:
##########
@@ -213,8 +213,8 @@ public int compareLiteral(LiteralExpr expr) {
if (expr == MaxLiteral.MAX_VALUE) {
return -1;
}
- if (expr instanceof StringLiteral) {
- return - ((StringLiteral) expr).compareLiteral(this);
+ if (!(expr instanceof IntLiteral) || !type.equals(expr.type)) {
+ return -1;
Review Comment:
This exact-type fallback makes the partition-pruning comparator unsafe for
an existing accepted predicate shape. `BinaryPredicate.getSlotBinding()` treats
`CastExpr(slot)` as bound to the underlying partition slot when
`CastExpr.canHashPartition()` is true for fixed-point and date casts, and
`ScanNode.expressionToRanges()` then wraps the opposite literal in
`ColumnBound` without retyping it to `desc.getColumn().getType()`. For an
INT/TINYINT partition column, a predicate such as `CAST(k AS BIGINT) = 1` can
therefore produce a BIGINT-typed filter bound while the partition map bounds
are INT/TINYINT-typed. This branch returns `-1` for both directions instead of
comparing the numeric value, so `ColumnBound.compareTo()` no longer defines a
valid ordering for `TreeRangeMap.subRangeMap()` and can prune away the matching
partition.
Please normalize partition filter literals to the actual partition column
type before building `ColumnBound`/`PartitionKey` filter ranges, or preserve
the previous reparse-to-column-type invariant for pruning filters, and add a
regression test for a casted fixed-point/date partition predicate.
--
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]