SELECT
date_trunc('month', created_at) AS "time",
count(total_count) AS "Count"
FROM talents
WHERE
created_at >= '2019-08-31T22:00:00Z'
AND created_at <= '2024-03-07T13:39:28.923Z'
AND ('ALL' = 'Armenia' OR country IN ('Armenia'))
GROUP BY 1
ORDER BY 1
Logical Plan
Search for Can't rewrite plan log message.
Error during rewrite: Can't detect Cube query and it may be not supported yet. Please check logs for additional information.
Version:
v0.34.25
Additional context
The query fails when I add AND ('ALL' = $COUNTRIES OR country IN ($COUNTRIES))
The $COUNTRIES is a variable in Grafana, which is query select distinct country from talents and "Include All option" is enabled. When I select some countries it works fine:
select
date_trunc('month', created_at) "time",
count(total_count) "Count"
from
talents
where
created_at >= '2019-08-31T22:00:00Z' and created_at <= '2024-03-07T13:49:15.895Z'
and country in ('Australia','Austria')
group by 1
order by 1
When I select the All option, I get the error:
Error during rewrite: Can't find rewrite due to 10081 AST node limit reached. Please check logs for additional information.
The countries number is slightly above 100 and cube server fails to perform this query.
And my attempt to overcome this limitation is:
to specify Custom all value in grafana ('ALL')
to avoid the field comparison by defining logical operator ('ALL' = $COUNTRIES OR country IN ($COUNTRIES))
But this also fails for cube.
Although such a query works to psql directly:
select count(*) from analytics.talents where ('ALL' = 'ALL' or country in ('ALL'));
select count(*) from analytics.talents where ('ALL' = 'Austria' or country in ('Austria'));
Both return result.
The first is equivalent to select count(*) from analytics.talents;
and the second is equivalent to select count(*) from analytics.talents where country in ('Austria');
Failed SQL
Logical Plan Search for
Can't rewrite plan
log message.Version: v0.34.25
Additional context The query fails when I add
AND ('ALL' = $COUNTRIES OR country IN ($COUNTRIES))
The$COUNTRIES
is a variable in Grafana, which is queryselect distinct country from talents
and "Include All option" is enabled. When I select some countries it works fine:When I select the All option, I get the error:
The countries number is slightly above 100 and cube server fails to perform this query.
And my attempt to overcome this limitation is:
'ALL'
)('ALL' = $COUNTRIES OR country IN ($COUNTRIES))
But this also fails for cube. Although such a query works to psql directly:
Both return result. The first is equivalent to
select count(*) from analytics.talents;
and the second is equivalent toselect count(*) from analytics.talents where country in ('Austria');