hatarist / clickhouse-cli

A third-party client for the Clickhouse DBMS server.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WITH TOTALS modifier doesn't work

marker1k opened this issue · comments

In original client you can add WITH TOTALS modifier and get totals of the request https://yadi.sk/i/xqJVqBki3WdTpf
It doesn't work in clickhouse-cli

Cheers! I totally forgot to fix it, found it myself a couple weeks ago.
It's because ClickHouse doesn't return the WITH TOTALS data while using FORMAT PrettyCompactMonoBlock (which is the default one in clickhouse-cli).

As of now, you can do a query with the explicitly given PrettyCompact format, or set the default format in the ~/.clickhouse-cli.rc. I'll get my hands on it later today.

 :) SELECT number % 3, count(1) FROM (SELECT number FROM system.numbers LIMIT 35) GROUP BY number % 3 WITH TOTALS FORMAT PrettyCompact;

┌─modulo(number, 3)─┬─count(1)─┐
│                 0 │       12 │
│                 1 │       12 │
│                 2 │       11 │
└───────────────────┴──────────┘

Totals:
┌─modulo(number, 3)─┬─count(1)─┐
│                 0 │       35 │
└───────────────────┴──────────┘

Ok. 4 rows in set. Elapsed: 0.310 sec. Processed: 0 rows, 0.0B (0 rows/s, 0.0B/s)

Thanks for the heads up!

Sorry for such a delay, pushed the 0.2.4.4 with a fix.