-
Notifications
You must be signed in to change notification settings - Fork 614
[jdbc-v2] Fix Database Metadata issue when wrong column data types are returned #2480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
/windsurf review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 To request another review, post a new comment with "/windsurf-review".
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue with incorrect column data types in the DatabaseMetadata results. Key changes include:
- Updates to test cases that verify the metadata result set columns and types.
- Enhancements in DatabaseMetaDataImpl.java to explicitly cast returned column values.
- Introduction of tests for unsigned integer types to validate proper type handling.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| jdbc-v2/src/test/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataTest.java | Added extensive tests to assert metadata column names and types. |
| jdbc-v2/src/test/java/com/clickhouse/jdbc/DataTypeTests.java | Added tests for unsigned integer types with proper result validation. |
| jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java | Updated SQL queries with explicit type casts for improved accuracy. |
Comments suppressed due to low confidence (1)
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java:1070
- Review the change of NULLABLE_COL from Int32 to Int16 to ensure it aligns with the expectations of consumers of database metadata.
private static final ClickHouseColumn NULLABLE_COL = ClickHouseColumn.of("NULLABLE", ClickHouseDataType.Int16.name());
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
Show resolved
Hide resolved
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
JDBC V1 CoverageCoverage Report
Class Coverage
|
|
Client V1 CoverageCoverage Report
Class Coverage
|




Summary
There are many methods in the DatabaseMetadata that return a ResultSet. Each of which should have defined list of columns and these columns should be a defined type.
This PR fixes the issue.
Closes #2475
Checklist
Delete items not relevant to your PR: