You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2017/07/06 18:42:00 UTC
[jira] [Assigned] (CALCITE-1872) PREV is parsed as LAST when the
name of the pattern referenced is not the same with the pattern being
defined
[ https://issues.apache.org/jira/browse/CALCITE-1872?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julian Hyde reassigned CALCITE-1872:
------------------------------------
Assignee: Zhiqiang He (was: Julian Hyde)
[~ransom], can you take a look at this?
> 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)