[ https://issues.apache.org/jira/browse/CALCITE-1872?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julian Hyde updated CALCITE-1872: --------------------------------- Labels: match (was: ) > PREV is parsed as LAST when the name of the pattern referenced is not the > same with the pattern being defined > ------------------------------------------------------------------------------------------------------------- > > Key: CALCITE-1872 > URL: https://issues.apache.org/jira/browse/CALCITE-1872 > 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 up_days, > LAST(UP.tstamp) AS total_days > PATTERN (STRT DOWN+ UP+) > DEFINE > DOWN AS DOWN.price < PREV(DOWN.price), > UP AS UP.price > PREV(DOWN.price) > ) AS T > {code} > is parsed as > {code} > ">(PREV(UP.$2, 0), LAST(DOWN.$2, 1))" > {code} > I think this is not correct. PREV defines a physical offset, while LAST > defines a logical offset. -- This message was sent by Atlassian JIRA (v6.4.14#64029)