-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[Fix][Connector-clickhouse] Fix SeaTunnelRow tableId set error #9585
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
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.
I found our test case not check SeaTunnelRow values and tableId which return by batchFetchRecords. Please add it.
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.
done.
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 pull request fixes an issue with tableId setting in SeaTunnelRow objects for the ClickHouse connector. The main problem was that the SQL string was being incorrectly used as the tableId instead of the proper table path identifier.
- Updates the
batchFetchRecordsmethod signature to accept aTablePathparameter - Modifies all calls to
batchFetchRecordsto pass the table path for proper tableId setting - Adds comprehensive test coverage to verify tableId is correctly set in returned SeaTunnelRow objects
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| ClickhouseProxy.java | Updates batchFetchRecords method signature to accept TablePath parameter and use it for tableId instead of SQL string |
| ClickhouseValueReader.java | Updates calls to batchFetchRecords to pass the table path parameter |
| ClickhouseValueReaderTest.java | Updates test mocks and adds new test to verify correct tableId setting behavior |
| ClickhouseSourceConfig.java | Adds server timezone configuration to the builder |
| public void testBatchFetchRecordsAndTableId() throws Exception { | ||
| // mock proxy query response | ||
| ClickhouseProxy proxy = Mockito.spy(new ClickhouseProxy(node)); | ||
| Field requestField = ClickhouseProxy.class.getDeclaredField("clickhouseRequest"); |
Copilot
AI
Jul 21, 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.
Using reflection to access private fields makes the test fragile and tightly coupled to implementation details. Consider adding a package-private constructor or setter method to ClickhouseProxy for testing purposes instead of using reflection.
| // mock proxy query response | ||
| ClickhouseProxy proxy = Mockito.spy(new ClickhouseProxy(node)); | ||
| Field requestField = ClickhouseProxy.class.getDeclaredField("clickhouseRequest"); | ||
| requestField.setAccessible(true); |
Copilot
AI
Jul 21, 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.
Setting field accessibility bypasses encapsulation and can cause issues in environments with security managers. This approach is brittle and should be replaced with proper dependency injection or test-friendly constructors.
Purpose of this pull request
fix #9584
Does this PR introduce any user-facing change?
How was this patch tested?
Check list
New License Guide