-
Notifications
You must be signed in to change notification settings - Fork 614
[JDBC-V2] Fixed spatial data returning correct type and object #2581
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
|
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.
Other comments (1)
- jdbc-v2/src/test/java/com/clickhouse/jdbc/DataTypeTests.java (1936-1936) There's a typo in the table name: 'test_geo_muti_polygon' should be 'test_geo_multi_polygon' to match the test name and data type.
💡 To request another review, post a new comment with "/windsurf-review".
| public boolean equals(Object obj) { | ||
| if (this == obj) { | ||
| return true; | ||
| } | ||
| if (obj == null || getClass() != obj.getClass()) { | ||
| return false; | ||
| } | ||
| Array other = (Array) obj; | ||
| return type == other.type && java.util.Arrays.equals(array, other.array); | ||
| } |
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.
You've implemented equals() but not hashCode(). According to the Java contract, when overriding equals(), you should also override hashCode() to ensure that equal objects have the same hash code. This is important if instances of this class will be used in hash-based collections like HashMap or HashSet.
Consider adding a matching hashCode() implementation like:
| public boolean equals(Object obj) { | |
| if (this == obj) { | |
| return true; | |
| } | |
| if (obj == null || getClass() != obj.getClass()) { | |
| return false; | |
| } | |
| Array other = (Array) obj; | |
| return type == other.type && java.util.Arrays.equals(array, other.array); | |
| } | |
| @Override | |
| public boolean equals(Object obj) { | |
| if (this == obj) { | |
| return true; | |
| } | |
| if (obj == null || getClass() != obj.getClass()) { | |
| return false; | |
| } | |
| Array other = (Array) obj; | |
| return type == other.type && java.util.Arrays.equals(array, other.array); | |
| } | |
| @Override | |
| public int hashCode() { | |
| int result = type; | |
| result = 31 * result + java.util.Arrays.hashCode(array); | |
| return result; | |
| } |
| Object asObject = rs.getObject(geomColumn); | ||
| Array asArray = rs.getArray(geomColumn); |
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.
The test retrieves asObject and asArray but doesn't verify their values. Consider adding assertions to validate the returned data matches the expected values, similar to how it's done in the testGeoPoint1 method.
JDBC V1 CoverageCoverage Report
Class Coverage
|
Client V1 CoverageCoverage Report
Class Coverage
|
|
|
@chernser Thanks for this fix! As you can see by the testing suite I provided this is a crucial functionality that we need. I can't wait for the fix to land in the new version of DBeaver/Driver. Thanks again |
|
@duvenagep |









Summary
ResultSet.getObjectCloses #2577
Checklist
Delete items not relevant to your PR: