BinTaoMa opened a new pull request, #11805:
URL: https://github.com/apache/seatunnel/pull/11805

   ## Purpose
   
   Fixes a ClassCastException thrown when the DataValidator transform's RANGE
   rule validates a DECIMAL field against integer bounds.
   
   ## Problem
   
   - The field value of a DECIMAL column is read as java.math.BigDecimal.
   - RANGE bounds (min_value / max_value) are parsed by
     DataValidatorTransformConfig#parseComparable into Integer / Long / Double,
     never BigDecimal.
   - RangeValidationRule#validate then calls Comparable.compareTo between a
     BigDecimal and an Integer, which throws:
     java.lang.ClassCastException: class java.lang.Integer cannot be cast to 
class java.math.BigDecimal
   
   ## Solution
   
   Normalize numeric values and numeric bounds to BigDecimal before comparing in
   RangeValidationRule#validate. Non-numeric (String) values keep the existing
   Comparable semantics.
   
   ## Verification
   
   - Added 
DataValidatorTransformTest#rangeRuleShouldAcceptDecimalFieldWithIntegerBounds,
     which fails with the ClassCastException before the fix and passes after.
   - mvn -pl seatunnel-transforms-v2 -Dtest=DataValidatorTransformTest test
   
    Closes #11804


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