github-actions[bot] commented on code in PR #68134:
URL: https://github.com/apache/doris/pull/68134#discussion_r4044629650


##########
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:
   **[P1] Keep FE nullability aligned with the D2-to-D3 kernel**
   
   For a NOT NULL `DECIMALV2(27,0)` cast to `DECIMALV3(19,0)`, this now uses 
`EXECUTION_RANGE == 18`, so FE declares a non-nullable result. BE does 
normalize execution to `(27,9)`, but it retains the original `(27,0)` metadata; 
the D2-to-D3 specialization computes `narrow_integral` from the original 27 
integer digits and always wraps the result in `ColumnNullable` when `27 > 19`, 
even in strict mode. `VExpr::execute_column` then validates that nullable 
physical column against the non-nullable DECIMALV3 descriptor and returns an 
internal type-mismatch error. This is distinct from the earlier 
execution-domain thread: the effective value range is not the problem; the 
current BE result shape still follows schema metadata. Please either align the 
kernel's wrapper decision with the effective domain or keep FE nullability 
aligned with the current kernel, and add strict/non-strict execution coverage 
for 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]

Reply via email to