Closed alxhill closed 1 week ago
@alxhill thank you! I probably know where issue is...
@alxhill
the issue is in how client read response from server in different formats.
As workaround I may suggest using query with format com.clickhouse.data.ClickHouseFormat#JSONEachRow
In this case error message is completely parsed.
If I add FORMAT JSONEachRow
to the end of the query itself, the stack traces are still missing additional context but do have the message shown above. If I use settings.setFormat(ClickHouseFormat.JSONEachRow)
, I get the following stack trace:
com.clickhouse.client.api.ServerException: Code: 636. DB::Exception: <Unreadable error message>
at com.clickhouse.client.api.internal.HttpAPIClientHelper.readError(HttpAPIClientHelper.java:318) ~[client-v2-0.7.1.jar:client-v2 0.7.1 (revision: 3667f7d)]
at com.clickhouse.client.api.internal.HttpAPIClientHelper.executeRequest(HttpAPIClientHelper.java:357) ~[client-v2-0.7.1.jar:client-v2 0.7.1 (revision: 3667f7d)]
at com.clickhouse.client.api.Client.lambda$query$11(Client.java:1568) ~[client-v2-0.7.1.jar:client-v2 0.7.1 (revision: 3667f7d)]
at com.clickhouse.client.api.Client.runAsyncOperation(Client.java:1942) ~[client-v2-0.7.1.jar:client-v2 0.7.1 (revision: 3667f7d)]
at com.clickhouse.client.api.Client.query(Client.java:1644) ~[client-v2-0.7.1.jar:client-v2 0.7.1 (revision: 3667f7d)]
(that's unedited, the message is literally "<Unreadable error message>
")
@alxhill new version with fix is release (0.7.1-patch). It should be soon be in Maven central.
We create tables from user-provided csvs, which may sometimes be invalid (e.g duplicate columns, missing values for some columns), and catch and parse exceptions from clickhouse to show a message to the user.
V1 Client Behaviour
Previously we got error messages depending on the issue with the underlying file:
Duplicate Column
Empty File
Rows have different numbers of values
V2 Client Behaviour
It now returns only the first part of the error, so we can't figure out the root cause from the Exception. Here's a logged stack trace for an empty file:
and here's one for rows have different numbers of values:
As you can see, we can no longer distinguish between the two errors.