Sergey Nuyanzin created CALCITE-7644:
----------------------------------------

             Summary:  Window's ORDER BY expression is unparsed as positional 
ordinal
                 Key: CALCITE-7644
                 URL: https://issues.apache.org/jira/browse/CALCITE-7644
             Project: Calcite
          Issue Type: Bug
          Components: core
            Reporter: Sergey Nuyanzin
            Assignee: Sergey Nuyanzin


Example sql
{code:sql}
SELECT "employee_id", "salary", "hire_date",
       SUM("salary") OVER (
         PARTITION BY "employee_id"
         ORDER BY CASE WHEN "salary" > 1000 THEN 1 ELSE 0 END
         RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS "sum_val"
FROM "employee"
{code}

{{OVER}} part will be unparsed as {{ OVER (PARTITION BY "employee_id" ORDER BY 
4 RANGE ...)}}
while it should be
{{OVER (PARTITION BY "employee_id" ORDER BY CASE WHEN ... THEN 1 ELSE 0 END 
RANGE ...)}}

it seems only  occurs after {{ProjectToWindowRule}}.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to