-
Notifications
You must be signed in to change notification settings - Fork 614
[client-v2] Adding JSON support with predefined paths #2531
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
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
JDBC V1 CoverageCoverage Report
Class Coverage
|
Client V1 CoverageCoverage Report
Class Coverage
|
…imports and undeprecated ClickHouseUtils as we use it
|
| public static final String JSON_MAX_DYN_TYPES_PARAM = "max_dynamic_types"; | ||
| public static final String JSON_SKIP_MARKER = "SKIP"; | ||
|
|
||
| public static void parseJSONColumn(String args, List<ClickHouseColumn> nestedColumns, List<String> parameters) { |
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.
Doesn't it deserve a dedicated set of tests?
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.
This part is tested via integration tests. I think no need to duplicate same in unit.
While testing I'm checking coverage to make sure integration tests validate the code.
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 adds JSON support with predefined paths for client-v2, enabling proper handling of JSON columns where path types are encoded for RowBinary format instead of Dynamic format when predefined paths are specified.
- Adds JSON column parsing logic to handle predefined paths and parameters in column definitions
- Updates binary format reader to use predefined column types when reading JSON data
- Adds comprehensive test coverage for various JSON column definition formats
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| clickhouse-data/src/main/java/com/clickhouse/data/ClickHouseColumn.java | Implements JSON column parsing with predefined paths and parameters support |
| client-v2/src/main/java/com/clickhouse/client/api/data_formats/internal/BinaryStreamReader.java | Updates JSON data reading to use predefined column types from schema |
| clickhouse-data/src/test/java/com/clickhouse/data/ClickHouseColumnTest.java | Adds unit tests for JSON column parsing validation |
| client-v2/src/test/java/com/clickhouse/client/datatypes/DataTypeTests.java | Adds integration tests for JSON binary format reading |
| jdbc-v2/src/test/java/com/clickhouse/jdbc/DataTypeTests.java | Adds JDBC integration test for JSON binary reading |
| clickhouse-data/src/main/java/com/clickhouse/data/ClickHouseUtils.java | Removes deprecated annotation from utility class |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
client-v2/src/main/java/com/clickhouse/client/api/data_formats/internal/BinaryStreamReader.java
Show resolved
Hide resolved
| nestedColumns.sort(Comparator.comparing(o -> o.getDataType().name())); | ||
| column = new ClickHouseColumn(ClickHouseDataType.JSON, name, originalTypeName, nullable, lowCardinality, | ||
| parameters, nestedColumns); | ||
| column.jsonPredefinedPaths = nestedColumns.stream().collect(Collectors.toMap(ClickHouseColumn::getColumnName, |
Copilot
AI
Aug 17, 2025
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.
[nitpick] The line continuation should be properly aligned. The lambda parameter c -> c on the next line should be aligned with the method call parameters.
| column.jsonPredefinedPaths = nestedColumns.stream().collect(Collectors.toMap(ClickHouseColumn::getColumnName, | |
| column.jsonPredefinedPaths = nestedColumns.stream().collect(Collectors.toMap( | |
| ClickHouseColumn::getColumnName, |



Summary
Closes #2462
Checklist
Delete items not relevant to your PR: