-
Notifications
You must be signed in to change notification settings - Fork 68
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
[Bug?] Macro $__conditionalAll sets 1=1
in empty variable values
#947
Comments
Hey! Thanks for the detailed issue. For clarity, can you provide a SQL example of how you're using this macro? I see how an empty string would make sense, just want to make sure we're fixing your use case properly cc @aangelisc |
Hi @SpencerTorres , thank you for the quick response! Our current variable
The mac column is not Nullable, so we expect an empty string
We use this variable in our panels to apply a specific filter in the
I noticed that the Another comment @SpencerTorres , and apologies to reuse this ticket for this: We recently migrated all our dashboards from Altinity ClickHouse, which required several adjustments to some dashboards due to the implementation of this macro. Based on my understanding and code review, the idea for the $__conditionalAll macro originates from the Altinity-ClickHouse plugin (#46), but the implementation differs slightly:
|
Hi @SpencerTorres , do you need more information? |
Hi @SpencerTorres , I really appreciate your work on the PR! However, IMHO, to avoid conflicts with #262 , it might be better to create a new macro to replicate the behavior as the altinity-clickHouse datasource plugin (originally suggested in #46 ). This new macro would replace the Here's an example use case: based on the value of variable
Thanks! |
Hi @SpencerTorres , @aangelisc Since the proposed PR hasn't been merged yet, I wanted to check in and get your thoughts on my suggestion to maintain compatibility with the current $__conditionalAll and do not break with #262 What do you think? |
We discussed it the other week in a meeting, and in my opinion, the open PR is the most correct solution. I think a breaking change is acceptable in this case, because the old behavior seems incorrect. Let me know what you think |
Thanks for the feedback @SpencerTorres I completely agree with your points. I just wanted you to consider the possibility of modifying the current macro to replace That said, and apologies for this, it’s outside the scope of this issue, so if you agree, I’ll open a new feature request (FR) to implement a new macro that replaces with an empty string, instead of Thank you! |
@sbengo good idea, lets split this into a new issue as a dedicated feature request 👍 |
What happened:
We have a Grafana selector that allows empty string values (''), which are valid in our context. However, when using the macro $__conditionAll, it is being replaced with 1=1, even though an empty string should be considered a valid selection.
For reference, the current documentation of the macro is as follows (README.md):
condition
or1=1
What you expected to happen:
If the Grafana selector has an empty string value
''
, the macro$__conditionAll
should not be replaced, as this value can be supported and is valid for applying the specific condition.Code:
clickhouse-datasource/src/data/CHDatasource.ts
Line 268 in e4fce05
Questions:
Environment:
The text was updated successfully, but these errors were encountered: