-
Notifications
You must be signed in to change notification settings - Fork 104
Add macros $__adhoc_column #1491
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
base: main
Are you sure you want to change the base?
Conversation
|
Adhoc filters are a little unreliable with complex queries. We have been discussing using a CH abstract syntax tree that would be able to be "smarter" with the placement of adhoc clauses. I do not think we want to go this direction because adhoc filters are supposed to work without modifying your queries. If we implement an $__adhoc_column macro and, in the future we fix adhoc queries, we would never be able to deprecate this macro without requesting users to edit their queries. I am wondering what advantage adding $__adhoc_column has over using template variables. Thank you for creating this PR and thinking of ways adhoc filters can be better! |
|
The problem is described in #1490. If you could suggest how to implement this using existing tools, that would be great. |
|
@Smelentyev I see what you mean now. I think the reason this was removed is that parsing the table does not always work and we were hoping the adhoc filters could be changed by Grafana to better support this use case. We are discussing internally other ways this problem might be solved. |
Summary
Fixes an issue where ad hoc filters fail when executing long or complex ClickHouse queries.
Previously, ad hoc filtering could time out or mis-handle large SQL statements, especially when the filter variable contained multiple conditions.
This change adjusts query handling to properly support long query strings by improving SQL parsing and execution logic.
What this PR does
How to test
SELECT DISTINCTquery (e.g., filtering over multiple joined tables).Related issues
Fixes #1490
Notes
This change should enhance stability and user experience for dashboards using ad hoc filters on large tables.