You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
SQL API is unable to handle where clauses including the condition column in (null). Instead it throws an "Unexpected panic" error.
To Reproduce
Using SQL API, query a column from any Cube using where (<column> is null or <column> in (null) and (1<>1)) as a filter. Should see an error (details below).
Alternatively, a minimal reprex with a fresh installation of Postgres and Cube:
Create a fresh Postgres and Cube setup with Docker
Add a table to Postgres and insert some data
CREATETABLEtbl (
id serialPRIMARY KEY,
label text
);
INSERT INTO tbl(label) VALUES ('one'), ('two'), (NULL), ('four');
Query the database directly: select * from tbl where (label is null or label in (null) and (1<>1)). Should get row 3 returned without error.
Create a Cube data model for tbl (schema below)
Query the cube using the same SQL syntax
See error
Error during rewrite: Unexpected panic. Reason: Unsupported filter scalar: NULL. Please check logs for additional information.
Logs show
thread 'tokio-runtime-worker' panicked at /__w/cube/cube/rust/cubesql/cubesql/src/compile/rewrite/rules/filters.rs:3573:18:
Unsupported filter scalar: NULL
SQL API Error: c4df0a8c-46b8-470c-a92f-9c78328ebeca-span-1 (6ms)
--
{
"sql": "select * from tbl where (label is null or label in (null) and (1<>1))"
}
--
{
"securityContext": {},
"appName": "NULL",
"protocol": "postgres",
"apiType": "sql"
}
Error during rewrite: Unexpected panic. Reason: Unsupported filter scalar: NULL. Please check logs for additional information.
Cube SQL Error: undefined
--
"SELECT * FROM tbl WHERE (label IS NULL OR label IN (NULL) AND (1 <> 1))"
--
{
"protocol": "postgres",
"apiType": "sql",
"appName": "NULL",
"sanitizedQuery": "SELECT * FROM tbl WHERE (label IS NULL OR label IN (NULL) AND (1 <> 1))"
}
Error during rewrite: Unexpected panic. Reason: Unsupported filter scalar: NULL. Please check logs for additional information.
Expected behavior
Cube SQL API query should return the same result as direct query to Postgres
Describe the bug
SQL API is unable to handle
where
clauses including the conditioncolumn in (null)
. Instead it throws an "Unexpected panic" error.To Reproduce
Using SQL API, query a column from any Cube using
where (<column> is null or <column> in (null) and (1<>1))
as a filter. Should see an error (details below).Alternatively, a minimal reprex with a fresh installation of Postgres and Cube:
select * from tbl where (label is null or label in (null) and (1<>1))
. Should get row 3 returned without error.tbl
(schema below)Expected behavior
Cube SQL API query should return the same result as direct query to Postgres
Minimally reproducible Cube Schema
Version:
Cube: 1.1.18
Postgres: 16
Additional Context
where label is null
without theor label in (null) and (1<>1)
as a workaroundThe text was updated successfully, but these errors were encountered: