Fang-Yu Rao created IMPALA-15573:
------------------------------------
Summary: Calcite could not covert the query to the logical plan
for COUNT(*) OVER (PARTITION BY)
Key: IMPALA-15573
URL: https://issues.apache.org/jira/browse/IMPALA-15573
Project: IMPALA
Issue Type: Bug
Reporter: Fang-Yu Rao
We found the following query could result in an {{IllegalArgumentException}} if
we use Calcite as the planner. This is the query at
[https://github.com/apache/impala/blob/1092b07/testdata/workloads/functional-query/queries/QueryTest/ranger_row_filtering.test#L178-L189].
{code:sql}
SELECT id, count(*) over (partition by
case
when id > (select max(id) from functional.alltypestiny) then id
else id + 5
end) as x
from functional.alltypes t2
order by id
limit 10
{code}
The following is the error message.
{code:java}
2026-10-15 17:11:53 [Exception] ERROR: Query bb442b147f0c59ee:f3b7a83900000000
failed:
RuntimeException: java.lang.IllegalArgumentException: not found: $SCALAR_QUERY({
LogicalAggregate(group=[{}], EXPR$0=[MAX($0)])
LogicalProject(id=[$0])
LogicalTableScan(table=[[functional, alltypestiny]])
})
CAUSED BY: IllegalArgumentException: not found: $SCALAR_QUERY({
LogicalAggregate(group=[{}], EXPR$0=[MAX($0)])
LogicalProject(id=[$0])
LogicalTableScan(table=[[functional, alltypestiny]])
})
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)