You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Dian Fu (JIRA)" <ji...@apache.org> on 2017/07/05 08:30:00 UTC
[jira] [Created] (CALCITE-1872) PREV is parsed as LAST when the
name of the pattern referenced is not the same with the pattern being
defined
Dian Fu created CALCITE-1872:
--------------------------------
Summary: 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: Julian Hyde
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)