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

Julian Hyde reassigned CALCITE-1871:
------------------------------------

    Assignee: Zhiqiang He  (was: Julian Hyde)

[~ransom], can you take a look at this?

> Nesting LAST within PREV is not parsed correctly for MATCH_RECOGNIZE
> --------------------------------------------------------------------
>
>                 Key: CALCITE-1871
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1871
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Dian Fu
>            Assignee: Zhiqiang He
>              Labels: match
>
> For table {{Ticker}}:
> {code}
> symbol: string
> tstamp: long
> price: int
> {code}
> , the {{UP}} in the following sql
> {code}
> SELECT *
> FROM Ticker
> MATCH_RECOGNIZE (
>   MEASURES
>     STRT.tstamp AS start_tstamp,
>     LAST(DOWN.tstamp) AS bottom_tstamp,
>     LAST(UP.tstamp) AS end_tstamp
>   ONE ROW PER MATCH
>   PATTERN (STRT DOWN+ UP+)
>   DEFINE
>     DOWN AS DOWN.price < PREV(DOWN.price),
>     UP AS UP.price > PREV(LAST(DOWN.price, 1), 1)
> ) AS T
> {code}
> is parsed as follows:
> {code}
> ">(PREV(UP.$2, 0), LAST(DOWN.$2, 1))"
> {code}
> I think this is not as expected. According to the documentation about 
> MATCH_RECOGNIZE, it supports nesting {{LAST}}/{{FIRST}} within 
> {{PREV}}/{{NEXT}} and we should not just ignore the {{PREV}}.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to