[jdbc-v2] Fix Database Metadata issue when wrong column data types are returned#2480
Merged
[jdbc-v2] Fix Database Metadata issue when wrong column data types are returned#2480
Conversation
Contributor
Author
|
/windsurf review |
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
Show resolved
Hide resolved
There was a problem hiding this comment.
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
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




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: