github-actions[bot] commented on code in PR #65266:
URL: https://github.com/apache/doris/pull/65266#discussion_r3528220308
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/util/TypeCoercionUtils.java:
##########
@@ -1452,6 +1452,15 @@ private static DataType downgradeDecimalAndDateLikeType(
DecimalV3Type decimalV3Type = (DecimalV3Type) commonType;
return
DecimalV2Type.createDecimalV2Type(decimalV3Type.getPrecision(),
decimalV3Type.getScale());
}
+ // DecimalV2 slot vs DecimalV2 literal. Keep the slot side uncast so
simple delete predicates
+ // can still be pushed to storage as column-name predicates.
+ if (shouldDowngrade(DecimalV2Type.class, DecimalV2Type.class,
+ commonType, target,
+ d -> true,
+ o -> o.isLiteral() && o.getDataType().isDecimalV2Type(),
+ compareExpressions)) {
+ return target.getDataType();
Review Comment:
This downgrade is too broad for literals that are not exactly representable
by the slot type. Returning `target.getDataType()` here makes both comparison
predicates and IN predicates cast the literal down to the column type;
`DecimalLiteral` then rounds to the target scale. For example, with
`DECIMAL(8,5) c`, `c = 5.555555` would be evaluated against `CAST(5.555555 AS
DECIMAL(8,5))` (`5.55556`) instead of the wider DecimalV2 common scale, so it
can match or delete a row that should not satisfy the original predicate.
Please only take this slot-preserving path when every literal fits the target
range and scale without rounding; otherwise keep the wider common type.
--
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]