morrySnow commented on code in PR #68134:
URL: https://github.com/apache/doris/pull/68134#discussion_r4045376582
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Cast.java:
##########
@@ -215,9 +219,9 @@ public static boolean castNullable(boolean srcNullable,
DataType srcType, DataTy
return targetType.isBigIntType() && range >= BigIntType.RANGE;
} else if (targetType.isDecimalLikeType()) {
// Decimal to decimal
- int targetRange = targetType.isDecimalV2Type() ?
((DecimalV2Type) targetType).getRange()
+ int targetRange = targetType.isDecimalV2Type() ?
DecimalV2Type.EXECUTION_RANGE
: ((DecimalV3Type) targetType).getRange();
- int sourceRange = childDataType.isDecimalV2Type() ?
((DecimalV2Type) childDataType).getRange()
+ int sourceRange = childDataType.isDecimalV2Type() ?
DecimalV2Type.EXECUTION_RANGE
Review Comment:
Fixed in 6bc24db4c51. FE now mirrors the D2-to-D3 specialization: it uses
the source DECIMALV2 original precision/scale when deciding the physical
nullable result, while keeping the (27,9) execution domain for the other
DECIMALV2 cast paths. The comment documents why this must apply in both strict
and non-strict modes. I added strict/non-strict CAST coverage for
DECIMALV2(27,0) -> DECIMALV3(19,0), corrected the related TRY_CAST
expectations, and added the same D2-to-D3 case to TryCastTest. Verified with
CastTest and TryCastTest (37 tests, 0 failures) plus fe-core Checkstyle.
--
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]