jackylee-ch opened a new pull request, #10360:
URL: https://github.com/apache/paimon/pull/10360

   ### Purpose
   
   The `truncate` computed column (`Expression.TruncateComputer`) parses its
   width literal but never checks the sign. A non-positive width is only caught
   later, at per-row `eval`, and inconsistently: integer and `DECIMAL` columns
   throw `ArithmeticException: / by zero` once the sync job is already running,
   while `CHAR/VARCHAR` columns silently produce an empty string. A width of `0`
   or a negative value is never meaningful for truncation.
   
   This validates `width > 0` in the constructor, so a bad definition such as
   `--computed_column 'x=truncate(amount,0)'` fails fast at job build time with 
a
   clear message, mirroring the sibling `substring` expression that already
   validates its indices.
   
   ### Tests
   
   `TruncateComputerTest#testTruncateRejectsNonPositiveWidth` asserts the
   constructor rejects width `0` and negatives across 
int/bigint/decimal/varchar.
   Existing positive-width coverage is unaffected.
   
   ### API and Format
   
   No change.
   
   ### Documentation
   
   No change.
   


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