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

   Yes, contributing this fix to Apache SeaTunnel.
   
   ### Purpose of this pull request
   
   Fixes #12869. JSON deserialization lost precision when DECIMAL occurred only 
inside an array. For example, `{"amounts":[3.14159265358979323846]}` with 
`ARRAY<DECIMAL(38,20)>` became `3.141592653589793`, while the same value in a 
scalar DECIMAL stayed exact.
   
   Extend the existing private decimal-type check through `ArrayType` elements. 
This also covers nested arrays and rows inside arrays, and enables the same 
decimal-preserving parser already used for scalar DECIMAL. No converter 
redesign, dependency or public API change.
   
   ### Does this PR introduce any user-facing change?
   
   Declared DECIMAL values inside arrays retain their numeric precision. The 
mapper setting applies to the whole document, so a bare floating-point number 
mapped to a STRING field in an affected schema may also retain more digits. 
Decimal rendering can normalize exponent notation; original numeric token 
spelling is not promised. Quoted strings and schemas without DECIMAL retain 
their behavior.
   
   English and Chinese format docs and upgrade notes describe this effect. No 
option, default or row shape changes.
   
   ### How was this patch tested?
   
   JDK 17.0.18:
   
   - Before the fix: 32 tests in the existing row JSON suite, three independent 
array/nested-array/row-in-array precision failures, zero errors/skips. Scalar 
and ordinary-array controls passed.
   - After the fix: all JSON format suites, 63 tests, zero 
failures/errors/skips. Includes scalar-sibling, mixed numeric STRING, 
quoted-string and non-DECIMAL controls.
   - Scoped `spotless:apply` and build-time format checks passed.
   - Root `./mvnw -q -DskipTests verify` passed; root verify skips test 
execution.
   - Full six-file patch independently reviewed before submission.
   
   ```sh
   ./mvnw -B -pl seatunnel-formats/seatunnel-format-json -am \
     '-Dtest=org.apache.seatunnel.format.json.**.*Test' \
     -Dsurefire.failIfNoSpecifiedTests=false package
   ```
   
   ### Check list
   
   - [x] Regression coverage extends the existing JSON test suite.
   - [x] English/Chinese format docs and compatibility notes updated.
   - [x] Required local verification completed.
   - No new dependencies or connector registration.
   
   <sub>Implementation and tests assisted by DeepSeek and Codex; this 
description was drafted and posted by an AI assistant for @hutiefang76.</sub>
   


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