[ 
https://issues.apache.org/jira/browse/CALCITE-7734?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sergey Nuyanzin updated CALCITE-7734:
-------------------------------------
    Description: 
An unqualified {{MEASURES}}/{{DEFINE}} column is expanded to {{<table>.<col>}}, 
so the pattern-variable alpha becomes the table name (e.g. {{LAST(emps.$4)}}) 
instead of the universal row pattern variable * ({{LAST(*.$4)}}). A table name 
is not
  a pattern variable, so the plan cannot be implemented.

for instance
{code:sql}
SELECT * FROM "hr"."emps" match_recognize (
    ORDER BY "empid" DESC
    MEASURES "commission" AS c
    PATTERN (s up)
    DEFINE up AS "commission" < prev("commission"))
{code} 
produces plan containing 
{{LAST(emps.$4, ...)}} instead of {{LAST(*.$4, ...)}}

seems to be a regression after CALCITE-7480


  was:
An unqualified {{MEASURES}}/{{DEFINE}} column is expanded to {{<table>.<col>}}, 
so the pattern-variable alpha becomes the table name (e.g. {{LAST(emps.$4)}}) 
instead of the universal row pattern variable * ({{LAST(*.$4)}}). A table name 
is not
  a pattern variable, so the plan cannot be implemented.

for instance
{code:sql}
SELECT * FROM "hr"."emps" match_recognize (
    ORDER BY "empid" DESC
    MEASURES "commission" AS c
    PATTERN (s up)
    DEFINE up AS "commission" < prev("commission"))
{code} 
produces plan containing 
{{LAST(emps.$4, ...)}} instead of {{LAST(*.$4, ...)}}



> MATCH_RECOGNIZE with an unqualified column in MEASURES/DEFINE produces an 
> unusable plan
> ---------------------------------------------------------------------------------------
>
>                 Key: CALCITE-7734
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7734
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Sergey Nuyanzin
>            Assignee: Sergey Nuyanzin
>            Priority: Major
>
> An unqualified {{MEASURES}}/{{DEFINE}} column is expanded to 
> {{<table>.<col>}}, so the pattern-variable alpha becomes the table name (e.g. 
> {{LAST(emps.$4)}}) instead of the universal row pattern variable * 
> ({{LAST(*.$4)}}). A table name is not
>   a pattern variable, so the plan cannot be implemented.
> for instance
> {code:sql}
> SELECT * FROM "hr"."emps" match_recognize (
>     ORDER BY "empid" DESC
>     MEASURES "commission" AS c
>     PATTERN (s up)
>     DEFINE up AS "commission" < prev("commission"))
> {code} 
> produces plan containing 
> {{LAST(emps.$4, ...)}} instead of {{LAST(*.$4, ...)}}
> seems to be a regression after CALCITE-7480



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

Reply via email to