lvyanquan commented on code in PR #4503:
URL: https://github.com/apache/flink-cdc/pull/4503#discussion_r3801492999


##########
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/parser/JaninoCompiler.java:
##########


Review Comment:
   `decimalPrecisionMode` is not propagated to all 
`deduceSubExpressionType(...)` calls in `JaninoCompiler`. The calls used by 
collection constructors, `IFNULL`, and `NULLIF` still select the overload that 
defaults to `UP_TO_19`.
   
   As a result, even when `transform.decimal.precision.mode` is configured as 
`UP_TO_38`, expressions such as:
   
   ```sql
   IFNULL(
     deposit + CAST(1 AS DECIMAL(1, 0)),
     CAST(0 AS DECIMAL(1, 0))
   )
   ```
   
   may still infer and coerce the intermediate result using 19-digit precision, 
potentially causing rounding or returning `null`.
   
   Please pass `context.decimalPrecisionMode` to all four affected calls in:
   
   - `generateCollectionConstructorOperation` (`JaninoCompiler.java`, lines 
502–506 and 550–554)
   - `generateIfNullOperation` (`JaninoCompiler.java`, lines 1037–1041)
   - `generateNullIfOperation` (`JaninoCompiler.java`, lines 1060–1064)
   
   For example:
   
   ```java
   TransformParser.deduceSubExpressionType(
           context.columns,
           sqlBasicCall,
           context.udfDescriptors,
           context.supportedMetadataColumns,
           context.decimalPrecisionMode);
   ```
   
   Please also add coverage for DECIMAL expressions nested inside `IFNULL` and 
collection constructors under `UP_TO_38`.



-- 
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]

Reply via email to