You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Zhiqiang He (JIRA)" <ji...@apache.org> on 2017/07/08 02:40:01 UTC
[jira] [Commented] (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:comment-tabpanel&focusedCommentId=16078914#comment-16078914 ]
Zhiqiang He commented on CALCITE-1872:
--------------------------------------
[~julianhyde] OK, I will test it.
> 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)