calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julian Feinauer (Jira)" <>
Subject [jira] [Created] (CALCITE-3294) Implement FINAL Clause for MATCH_RECOGNIZE
Date Mon, 26 Aug 2019 12:03:00 GMT
Julian Feinauer created CALCITE-3294:

             Summary: Implement FINAL Clause for MATCH_RECOGNIZE
                 Key: CALCITE-3294
             Project: Calcite
          Issue Type: Improvement
            Reporter: Julian Feinauer

With CALCITE-1935 the initial support for the MATCH_RECOGNIZE clause was introduced. But it
is still lacking several features.
One of them is the FINAL Clause which forces the `MEASURE` to act global on all Tuples which
were matched by the pattern.


An example query would be:

FROM sales_history MATCH_RECOGNIZE (
         ORDER BY tstamp
                   LAST(A.tstamp) AS ts_prev,
                   FINAL LAST(A.tstamp) AS ts_last
         PATTERN (A+)
           A AS A.units_sold > 10
       ) MR
ORDER BY MR.product, MR.start_tstamp;

Here, the query matches for each sequence of rows which all have `units_sold > 10`.
For the column `ts_prev` it always shows the timestamp of the timestamp of the previous match
(the row before).
But for `ts_last` it shows the SAME value for each column as the `FINAL` modifier changes
teh behavior to apply the `LAST` operator to the record set (similar to a window aggregation
on the machted subset of rows).

This message was sent by Atlassian Jira

View raw message