-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
questionThe issue is a question. Please use Stack Overflow for questions.The issue is a question. Please use Stack Overflow for questions.
Description
Problem
When combining a dimension and a measure within an and filter, Cube.js raises the following error:
You cannot use dimension and measure in same condition
Example (failing query)
{
"dimensions":
[
"customers.id"
],
"filters":
[
{
"and":
[
{
"member": "items.quantity",
"operator": "gt",
"values":
[
"1"
]
},
{
"member": "item.id",
"operator": "equals",
"values":
[
"1234"
]
}
]
}
]
}If the same filters are moved to the top level (without the and wrapper), the query runs successfully:
{
"dimensions":
[
"customers.id"
],
"filters":
[
{
"member": "items.quantity",
"operator": "gt",
"values":
[
"1"
]
},
{
"member": "item.id",
"operator": "equals",
"values":
[
"1234"
]
}
]
}Both versions should be equivalent. Logically they produce the same SQL, differing only in an extra set of parentheses around the WHERE clause:
-- With `and` filter
WHERE ((filter1) AND (filter2))
-- Without `and` filter
WHERE (filter1) AND (filter2)Question: Is the current behaviour expected, or should Cube.js handle both forms equivalently?
If not, should the non-and version also raise the same validation error for consistency?
Metadata
Metadata
Assignees
Labels
questionThe issue is a question. Please use Stack Overflow for questions.The issue is a question. Please use Stack Overflow for questions.