Open igorlukanin opened 1 year ago
If you are interested in working on this issue, please leave a comment below and we will be happy to assign the issue to you. If this is the first time you are contributing a Pull Request to Cube.js, please check our contribution guidelines. You can also post any questions while contributing in the #contributors channel in the Cube.js Slack.
I have another scenario where a comparison is used resulting in the following error:
Arrow error: Compute error: Error: Syntax error: Unexpected keyword IS at
The culprite is the same, in a different scenario:
name: my_date
sql: CAST({CUBE}.reference_date AS TIMESTAMP) <= CURRENT_TIMESTAMP
type: boolean
When being cast as a boolean, it append IS TRUE
at the end. This result in CURRENT_TIMESTAMP IS TRUE
which is invalid
... CASE WHEN (CAST('my_table'.reference_date AS TIMESTAMP) <= CURRENT_TIMESTAMP IS TRUE
To fix it, you have to add explicit parentheses around the whole comparison Such as
name: my_date
sql: (CAST({CUBE}.reference_date AS TIMESTAMP) <= CURRENT_TIMESTAMP)
type: boolean
I would agree that the point of the tool is to make it less painful to write SQL, this requires us to debug the query for what should be a classic scenario Cheers
From Slack:
Given the following sample schema:
When I run the following query:
I expect output that looks something like the following(records where A is null):
However what I get is closer to the following:
Why this arises becomes more clear after looking at the generated SQL:
This comes as a in the SQL is replaced with b AND c AND NOT d which creates b AND c AND NOT d IS NULL which is not what I intended. Having come from Looker what I expected/intended as for something like the following.
@paveltiunov thinks that "ideally Cube should handle this."