Skip to content
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

Support of the block of totals #297

Open
nicktrandafil opened this issue Apr 13, 2023 · 3 comments
Open

Support of the block of totals #297

nicktrandafil opened this issue Apr 13, 2023 · 3 comments

Comments

@nicktrandafil
Copy link

With the SQL:

SELECT name
FROM workflow_jobs        
GROUP BY name
    WITH TOTALS
LIMIT 5, 5

clickhosue-cpp responds with exception unimplemented 7. Would be nice to have this feature.

@nicktrandafil
Copy link
Author

Is there a different way to obtain row count in a SQL which contains "LIMIT" before the limit is applied? I mean without employing two separate queries. This would be useful in implementing pagination on the data.

@Enmk
Copy link
Collaborator

Enmk commented Apr 25, 2023

Hello @nicktrandafil could you please share a simple SQL example to test this feature? That would help with development.

@nicktrandafil
Copy link
Author

Hello @Enmk. You could use the SQL which I provided in my first comment. I tested the feature on the official playground of Clickhouse

clickhouse client --secure --host play.clickhouse.com --user explorer

then

SELECT name               
FROM workflow_jobs
GROUP BY name                          
    WITH TOTALS   
LIMIT 5, 5                             
FORMAT JSON  

In the results there is the desired statistic rows_before_limit_at_least:

{
        ...
        "rows": 5,
        "rows_before_limit_at_least": 906,
        ...
}

Notice FORMAT JSON. In default format of response representation you wouldn't see this statistic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants