You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Dian Fu (JIRA)" <ji...@apache.org> on 2017/07/05 08:21:00 UTC
[jira] [Created] (CALCITE-1871) Nesting LAST within PREV is not
parsed correctly for MATCH_RECOGNIZE
Dian Fu created CALCITE-1871:
--------------------------------
Summary: 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: 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 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)