-
Notifications
You must be signed in to change notification settings - Fork 594
[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
base: main
Are you sure you want to change the base?
Conversation
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
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
Adds support for handling JSON columns with predefined paths in the ClickHouse client, enabling proper type encoding for RowBinary format instead of Dynamic type encoding when paths are predefined.
- Enhanced JSON column parsing to handle predefined paths with specific data types
- Modified binary reader to use predefined column types when available for JSON data
- Added comprehensive test coverage for various JSON column configurations
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
DataTypeTests.java | Adds integration tests for JSON binary format with various predefined path configurations |
BinaryStreamReader.java | Updates JSON data reading to use predefined column types when available |
ClickHouseColumn.java | Implements JSON column parsing logic to extract predefined paths and their types |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Map<String, Object> row = reader.next(); | ||
Object value = row.get("value"); | ||
System.out.println(value); | ||
} |
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.
System.out.println should not be used in test code. Consider using a logger or assertion to verify the expected behavior instead.
} | |
Object value = row.get("value"); | |
Assert.assertNotNull(value, "Value should not be null"); | |
Assert.assertEquals(value, jsonValue, "Retrieved value should match inserted JSON"); | |
} |
Copilot uses AI. Check for mistakes.
if (name.startsWith(JSON_SKIP_MARKER)) { | ||
name = null; // skip parameters | ||
i = ClickHouseUtils.skipContentsUntil(args, i, len, ',') - 1; | ||
} else if ( name.startsWith(JSON_MAX_PATHS_PARAM) || name.startsWith(JSON_MAX_DYN_TYPES_PARAM)) { |
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.
Extra space after opening parenthesis in the if condition.
} else if ( name.startsWith(JSON_MAX_PATHS_PARAM) || name.startsWith(JSON_MAX_DYN_TYPES_PARAM)) { | |
} else if (name.startsWith(JSON_MAX_PATHS_PARAM) || name.startsWith(JSON_MAX_DYN_TYPES_PARAM)) { |
Copilot uses AI. Check for mistakes.
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?
Summary
Closes #2462
Checklist
Delete items not relevant to your PR: