Skip to content

totals don't work with new Clickhouse server versions #1387

Open

Description

@den-crane
select sum(number), greater
    from (select number, number > 5 as greater from numbers(10))
group by greater with totals

ClickHouse 22.8.19.10 / ClickHouse JDBC Driver 0.4.6 (revision: dd91e17) -- totals OK
ClickHouse 23.3.5.9 / ClickHouse JDBC Driver 0.4.6 (revision: dd91e17) -- totals NOT OK

Activity

  1. changed the title [-]totals don't work anymore[/-] [+]totals don't work with new Clickhouse server versions[/+] on Jun 28, 2023
  2. zhicwu commented on Jun 28, 2023

    @zhicwu
    Contributor

    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.

    22.8.15.23
    00000000: 0201 7301 6706 5549 6e74 3634 0555 496e  ..s.g.UInt64.UIn
    00000010: 7438 0f00 0000 0000 0000 001e 0000 0000  t8..............
    00000020: 0000 0001 2d00 0000 0000 0000 00         ....-........
    
    23.3.6.7
    00000000: 0201 7301 6706 5549 6e74 3634 0555 496e  ..s.g.UInt64.UIn
    00000010: 7438 0f00 0000 0000 0000 001e 0000 0000  t8..............
    00000020: 0000 0001
    
  3. den-crane commented on Jun 29, 2023

    @den-crane
    ContributorAuthor

    @zhicwu
    Did you report this to Clickhouse?

  4. den-crane commented on Jun 30, 2023

    @den-crane
    ContributorAuthor

    I would throw an error, that totals are not supported.

  5. zhicwu commented on Jul 1, 2023

    @zhicwu
    Contributor

    Did you report this to Clickhouse?

    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.

  6. reopened this on Jul 1, 2023
  7. den-crane commented on Jul 4, 2023

    @den-crane
    ContributorAuthor

    It seems like totals is already detected https://github.com/search?q=repo%3AClickHouse%2Fclickhouse-java%20totals&type=code

    I would throw an error always, no matter format.

    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.

  8. zhicwu commented on Jul 4, 2023

    @zhicwu
    Contributor

    It seems like totals is already detected

    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.

  9. mzitnik commented on Aug 2, 2023

    @mzitnik
    Contributor

    @den-crane So looks like the problem solved on ClickHouse server side can we close it?

  10. 3 remaining items

  11. den-crane commented on Sep 11, 2023

    @den-crane
    ContributorAuthor
  12. shenluwei commented on Sep 11, 2023

    @shenluwei
    select sum(number), greater
        from (select number, number > 5 as greater from numbers(10))
    group by greater with totals

    ClickHouse 22.8.19.10 / ClickHouse JDBC Driver 0.4.6 (revision: dd91e17) -- totals OK ClickHouse 23.3.5.9 / ClickHouse JDBC Driver 0.4.6 (revision: dd91e17) -- totals NOT OK

    You need change your Driver to this one -------cc.blynk.clickhouse.ClickHouseDriver
    image

  13. den-crane commented on Sep 11, 2023

    @den-crane
    ContributorAuthor

    ClickHouse 22.8.19.10 / ClickHouse JDBC Driver 0.4.6 (revision: dd91e17) -- totals OK ClickHouse 23.3.5.9 / ClickHouse JDBC

    Thank you, I found another solution. I decided to retire and start growing cabbage.

  14. github-actions commented on Jan 8, 2025

    @github-actions

    This issue has been automatically marked as stale because it has not had activity in the last year. It will be closed in 30 days if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant. Thank you for your contributions!

  15. added
    jdbc-v2
    and removed on Jan 9, 2025
  16. modified the milestones: 0.10.0, 0.9.10 on Apr 15, 2026
  17. modified the milestones: 0.11.0, 0.12.0 on Sep 23, 2026
  18. added
    planned_work
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    action:verifyenhancementjdbc-v2planned_work

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions