-
Notifications
You must be signed in to change notification settings - Fork 614
[JDBC-V2, Client-V2] Fixes data type conversion to string #2580
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.
Other comments (3)
-
client-v2/src/main/java/com/clickhouse/client/api/internal/BaseCollectionConverter.java (198-200)
Include the original exception as the cause to preserve the stack trace:
} catch (IOException e) { throw new ClickHouseException(e.getMessage(), e); -
client-v2/src/main/java/com/clickhouse/client/api/internal/BaseCollectionConverter.java (207-209)
Include the original exception as the cause to preserve the stack trace:
} catch (IOException e) { throw new ClickHouseException(e.getMessage(), e); -
client-v2/src/main/java/com/clickhouse/client/api/DataTypeUtils.java (53-53)
There's an extra space between 'final' and 'SimpleDateFormat' in the declaration of OLD_TIME_WITH_NANOS_FORMATTER.
public static final SimpleDateFormat OLD_TIME_WITH_NANOS_FORMATTER = new SimpleDateFormat("HH:mm:ss.SSSSSSSSS");
💡 To request another review, post a new comment with "/windsurf-review".
| public static final SimpleDateFormat OLD_DATE_TIME_FORMATTER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
|
|
||
| public static final SimpleDateFormat OLD_DATE_FORMATTER = new SimpleDateFormat("yyyy-MM-dd"); | ||
|
|
||
| public static final SimpleDateFormat OLD_TIME_FORMATTER = new SimpleDateFormat("HH:mm:ss"); | ||
|
|
||
| public static final SimpleDateFormat OLD_TIME_WITH_NANOS_FORMATTER = new SimpleDateFormat("HH:mm:ss.SSSSSSSSS"); |
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 newly added SimpleDateFormat instances (OLD_DATE_TIME_FORMATTER, OLD_DATE_FORMATTER, OLD_TIME_FORMATTER, OLD_TIME_WITH_NANOS_FORMATTER) are not thread-safe. Consider using DateTimeFormatter instead, which is thread-safe, or ensure these formatters are used in a thread-safe manner.
| } else if (bytesOrString instanceof byte[]) { | ||
| sb.append(bytesOrString); |
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 byte array handling in stringToString() is incorrect. When appending a byte[] to StringBuilder with sb.append(bytesOrString), it will use the default toString() of byte[] which returns the object identity (like '[B@1a2b3c4d') rather than the actual content. Consider using new String((byte[])bytesOrString) or another appropriate conversion method.
client-v2/src/main/java/com/clickhouse/client/api/internal/BaseCollectionConverter.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
|
|


Summary
/added firstCloses #2575
Checklist
Delete items not relevant to your PR: