You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
totals don't work with new Clickhouse server versions #1387
action:verifydocumentationImprovements or additions to documentationenhancementjdbcModule: the JDBC driver (jdbc-v2; with legacy: the v1 driver)planned_workWork that is planned for nearest release. Good to takequeriesArea: how the client builds and runs statements (parameters, quoting, batches)
Thank you for reporting the issue. It appears that the problem is not limited to gRPC in the new version but also includes RowBinary or the method of generating the totals output.
No I didn't, as typically there is no response from anyone.
I would throw an error, that totals are not supported.
It's a bit difficult because 1) it requires SQL parsing to understand if the result should have totals or not; and 2) it's hard to tell if the server missed totals or not in RowBinary format(because it does not have a separator like the blank line added into TSV format).
I think it's good idea to be more defensive and add more validations on client side in case the server missed anything or protocol changed. Perhaps it would be beneficial to transition to the native data format, considering it as a first-class citizen.
to the native data format, considering it as a first-class citizen.
I don't like native, it requires much more compute power from the client. Some users will complain that JDBC driver needs 8GB RAM to process select results (to pivot very long native block). Go-driver has this issue, they just limited the max size of the native block in a result and reject to execute some queries at all.
Yes, almost forgot that :p However, determining whether the last few rows in the RowBinary format represent totals or not can be challenging.
I don't like native, it requires much more compute power from the client.
Offloading serialization and deserialization to clients can be beneficial in certain scenarios, particularly for improving server scalability and handling higher request loads, particularly during ingestion processes. #1357 does not benefit RowBinary much but I believe it helps for Native.
Recommendation: Keep open — maintainer decision
Decide whether the JDBC driver reads the totals row (the server writes it only in text formats), rejects WITH TOTALS with an error, or documents the limit.
Status on main: Not supported on main — at 8480ca001, ClickHouse 26.11.4.11, the issue's query gives the 2 group rows and no totals row, with no error, in jdbc-v2 and in the v1 driver. getMoreResults() returns false.
Breaking change: No — a new way to read the totals does not break. An error for each WITH TOTALS query (proposed in the thread) breaks queries that run now.
Analysis: jdbc-v2 reads results in RowBinaryWithNamesAndTypes. On the same server, the response has the totals row in TabSeparated (after an empty line), but not in RowBinaryWithNamesAndTypes or Native (curl; ClickHouse/ClickHouse#41236). The SQL parser of jdbc-v2 finds the clause (ClickHouseSqlStatement.java:272, hasWithTotals()), but no code calls it. docs/clickhouse-docs/jdbc.mdx does not say that a WITH TOTALS query returns no totals row.
Automated triage by Polyglot AI. A maintainer makes the final decision.
action:verifydocumentationImprovements or additions to documentationenhancementjdbcModule: the JDBC driver (jdbc-v2; with legacy: the v1 driver)planned_workWork that is planned for nearest release. Good to takequeriesArea: how the client builds and runs statements (parameters, quoting, batches)
Activity
[-]totals don't work anymore[/-][+]totals don't work with new Clickhouse server versions[/+]zhicwu commentedon Jun 28, 2023
Thank you for reporting the issue. It appears that the problem is not limited to gRPC in the new version but also includes RowBinary or the method of generating the totals output.
den-crane commentedon Jun 29, 2023
@zhicwu
Did you report this to Clickhouse?
den-crane commentedon Jun 30, 2023
I would throw an error, that totals are not supported.
zhicwu commentedon Jul 1, 2023
No I didn't, as typically there is no response from anyone.
It's a bit difficult because 1) it requires SQL parsing to understand if the result should have totals or not; and 2) it's hard to tell if the server missed totals or not in RowBinary format(because it does not have a separator like the blank line added into TSV format).
I think it's good idea to be more defensive and add more validations on client side in case the server missed anything or protocol changed. Perhaps it would be beneficial to transition to the native data format, considering it as a first-class citizen.
den-crane commentedon Jul 4, 2023
It seems like
totalsis already detected https://github.com/search?q=repo%3AClickHouse%2Fclickhouse-java%20totals&type=codeI would throw an error always, no matter format.
I don't like native, it requires much more compute power from the client. Some users will complain that JDBC driver needs 8GB RAM to process
selectresults (to pivot very long native block). Go-driver has this issue, they just limited the max size of the native block in a result and reject to execute some queries at all.zhicwu commentedon Jul 4, 2023
Yes, almost forgot that :p However, determining whether the last few rows in the RowBinary format represent totals or not can be challenging.
Offloading serialization and deserialization to clients can be beneficial in certain scenarios, particularly for improving server scalability and handling higher request loads, particularly during ingestion processes. #1357 does not benefit RowBinary much but I believe it helps for Native.
mzitnik commentedon Aug 2, 2023
@den-crane So looks like the problem solved on ClickHouse server side can we close it?
7 remaining items
polyglotAI-bot commentedon Nov 28, 2026
Recommendation: Keep open — maintainer decision
Decide whether the JDBC driver reads the totals row (the server writes it only in text formats), rejects
WITH TOTALSwith an error, or documents the limit.main: Not supported on main — at8480ca001, ClickHouse 26.11.4.11, the issue's query gives the 2 group rows and no totals row, with no error, in jdbc-v2 and in the v1 driver.getMoreResults()returnsfalse.WITH TOTALSquery (proposed in the thread) breaks queries that run now.Analysis: jdbc-v2 reads results in
RowBinaryWithNamesAndTypes. On the same server, the response has the totals row inTabSeparated(after an empty line), but not inRowBinaryWithNamesAndTypesorNative(curl; ClickHouse/ClickHouse#41236). The SQL parser of jdbc-v2 finds the clause (ClickHouseSqlStatement.java:272,hasWithTotals()), but no code calls it.docs/clickhouse-docs/jdbc.mdxdoes not say that aWITH TOTALSquery returns no totals row.Automated triage by Polyglot AI. A maintainer makes the final decision.