kezhuoquan opened a new pull request, #7393:
URL: https://github.com/apache/kyuubi/pull/7393
This commit fixes a bug where the DECIMAL type was incorrectly mapped to
BigInteger instead of BigDecimal in JdbcColumn, causing type mismatch issues.
### Why are the changes needed?
- In JDBC/Java, SQL DECIMAL/NUMERIC must map to java.math.BigDecimal to
preserve precision and scale. The current implementation maps DECIMAL to
java.math.BigInteger , which drops fractional parts and causes type mismatches.
- This incorrect mapping can break consumers that expect BigDecimal (e.g.,
ORMs(Mybatis)) and leads to inconsistent ResultSetMetaData#getColumnClassName
results for DECIMAL columns.
- The change aligns the client with common JDBC expectations and avoids
precision loss.
Change summary
- Replace the import and class name mapping for DECIMAL:
- Import fix: JdbcColumn.java
- Class name fix for DECIMAL: JdbcColumn.java:L128-L131
Impact scope
- Hive JDBC client type mapping for DECIMAL columns.
- Upstream frameworks/tools that rely on BigDecimal for accurate decimal
handling.
### How was this patch tested?
- Ran module tests locally:
```
mvn test -pl kyuubi-hive-jdbc -DskipTests=false
```
- Result: Tests run: 66, Failures: 0, Errors: 0, Skipped: 0
- This is a targeted metadata/type fix and does not alter other logic paths.
Existing tests passing indicates no regressions.
- If preferred, a follow‑up can add a focused assertion on DECIMAL’s
columnClassName / ResultSetMetaData to explicitly cover this path.
### Was this patch authored or co-authored using generative AI tooling?
- Generated-by: Trae AI (GPT-5-high)
- Human reviewed and validated with existing tests. No third‑party
copyrighted material included; the change replaces a JDK type reference in
accordance with ASF guidance.
Additional notes
- Working branch: fix-jdbc-decimal-mapping
- Affected module: kyuubi-hive-jdbc
- API/behavioral note: getColumnClassName for DECIMAL now correctly returns
java.math.BigDecimal . Consumers relying on the previous incorrect BigInteger
mapping will see the corrected type.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]