nacz0 opened a new pull request, #41525:
URL: https://github.com/apache/beam/pull/41525

   ## Summary
   
   A JDBC `DECIMAL(12,2)` currently becomes an unconstrained Beam `DECIMAL`, 
while `NUMERIC(12,2)` retains its declared parameters. Route both JDBC types 
through the existing numeric converter.
   
   ```diff
   - JDBC DECIMAL(p,s) -> DECIMAL
   + JDBC DECIMAL(p,s) -> FixedPrecisionNumeric(p,s)
   ```
   
   Treat metadata precision `0` as unspecified alongside `-1` and 
`Integer.MAX_VALUE`, so unknown precision does not become 
`FixedPrecisionNumeric(0,0)`. Add coverage for nullable fields, unspecified 
precision, decimal values, and nulls, and document the inferred-schema change 
in CHANGES.md.
   
   Fixes #41520. Related to #27380; this PR addresses JDBC schema inference 
independently of Avro conversion support.
   
   ## Evidence
   
   - **Before:** the new precision/scale test fails for JDBC `DECIMAL`; the 
unspecified-precision test fails for `NUMERIC` with precision `0`.
   - **After:** all **10 SchemaUtilTest tests pass**.
   - `spotlessJavaCheck`, `formatChanges`, and `validateChanges` pass.
   - Full JDBC unit suite: **107/108 pass** on Windows. The remaining 
`JdbcUtilTest.testSavesFilesAsExpected` failure (expected 2 files, received 0) 
reproduces identically with the unmodified production source.
   
   ```text
   ./gradlew :sdks:java:io:jdbc:test --tests 
org.apache.beam.sdk.io.jdbc.SchemaUtilTest
   ./gradlew :sdks:java:io:jdbc:spotlessJavaCheck :formatChanges 
:validateChanges
   ```
   
   ## Merge Danger
   
   **Door:** Two-way.
   
   **Blast Radius:** JDBC.
   
   This changes the inferred type of fixed-precision JDBC DECIMAL columns from 
plain DECIMAL to FixedPrecisionNumeric. Unconstrained NUMERIC metadata with 
precision 0 now uses plain DECIMAL. Consumers that inspect inferred schemas may 
need adjustments; AvroUtils support for FixedPrecisionNumeric remains a 
separate issue.
   
   Opening as a draft for review of the default schema change and whether 
compatibility requires opt-in behavior.


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