[
https://issues.apache.org/jira/browse/CALCITE-5202?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nicholas Jiang updated CALCITE-5202:
------------------------------------
Description:
A MATCH_RECOGNIZE clause enables the following tasks:
* Logically partition and order the data that is used with the PARTITION BY and
ORDER BY clauses.
* Define patterns of rows to seek using the PATTERN clause. These patterns use
a syntax similar to that of regular expressions.
* The logical components of the row pattern variables are specified in the
DEFINE clause.
* Define measures, which are expressions usable in other parts of the SQL
query, in the MEASURES clause.
MATCH_RECOGNIZE doesn't support to output the timeout matches at present, which
is a common requirement in CEP scenarios. Meanwhile MATCH_RECOGNIZE doesn't
support notNext, consecutive and until semantics:
* notNext represents that the new pattern enforces that there is no event
matching this pattern right after the preceding matched event.
* consecutive means that works in conjunction with mutiple times matching,
which specifies that any not matching element breaks the loop.
* until applies a stop condition for a looping state that allows cleaning the
underlying state.
The syntax of enhanced MATCH_RECOGNIZE is proposed as follows:
{code:sql}
MATCH_RECOGNIZE (
[ PARTITION BY <expr> [, ... ] ]
[ ORDER BY <expr> [, ... ] ]
[ MEASURES <expr> [AS] <alias> [, ... ] ]
[ ONE ROW PER MATCH [ { SHOW TIMEOUT MATCHES } ] |
ALL ROWS PER MATCH [ { SHOW TIMEOUT MATCHES } ]
]
[ AFTER MATCH SKIP
{
PAST LAST ROW |
TO NEXT ROW |
TO [ { FIRST | LAST} ] <symbol>
}
]
PATTERN ( <pattern> )
DEFINE <symbol> AS <expr> [, ... ]
)
{code}
* 'SHOW TIMEOUT MATCHES' is introduce to add timeout matches to the output.
*
was:
MATCH_RECOGNIZE only supports the output of matches, doesn't support the output
of timeout at present. WITH TIMEOUT ROWS is proposed to support for
MATCH_RECOGNIZE functional enhancement. The grammar of enhanced MATCH_RECOGNIZE
is as follows:
{code:sql}
SELECT [ ALL | DISTINCT ]
{ * | projectItem [, projectItem ]* }
FROM tableExpression
[MATCH_RECOGNIZE (
[PARTITION BY {partitionItem [, partitionItem]*}]
[ORDER BY {orderItem [, orderItem]*}]
[MEASURES {measureItem AS col [, measureItem AS col]*}]
[ONE ROW PER MATCH|ALL ROWS PER MATCH|ONE ROW PER MATCH WITH TIMEOUT ROWS|ALL
ROWS PER MATCH WITH TIMEOUT ROWS]
[AFTER MATCH SKIP]
PATTERN (patternVariable[quantifier] [ patternVariable[quantifier]]*) WITHIN
intervalExpression
DEFINE {patternVariable AS patternDefinationExpression [, patternVariable AS
patternDefinationExpression]*}
)];
{code}
> Support for MATCH_RECOGNIZE functionality enhancement
> -----------------------------------------------------
>
> Key: CALCITE-5202
> URL: https://issues.apache.org/jira/browse/CALCITE-5202
> Project: Calcite
> Issue Type: New Feature
> Reporter: Nicholas Jiang
> Priority: Major
>
> A MATCH_RECOGNIZE clause enables the following tasks:
> * Logically partition and order the data that is used with the PARTITION BY
> and ORDER BY clauses.
> * Define patterns of rows to seek using the PATTERN clause. These patterns
> use a syntax similar to that of regular expressions.
> * The logical components of the row pattern variables are specified in the
> DEFINE clause.
> * Define measures, which are expressions usable in other parts of the SQL
> query, in the MEASURES clause.
> MATCH_RECOGNIZE doesn't support to output the timeout matches at present,
> which is a common requirement in CEP scenarios. Meanwhile MATCH_RECOGNIZE
> doesn't support notNext, consecutive and until semantics:
> * notNext represents that the new pattern enforces that there is no event
> matching this pattern right after the preceding matched event.
> * consecutive means that works in conjunction with mutiple times matching,
> which specifies that any not matching element breaks the loop.
> * until applies a stop condition for a looping state that allows cleaning the
> underlying state.
> The syntax of enhanced MATCH_RECOGNIZE is proposed as follows:
> {code:sql}
> MATCH_RECOGNIZE (
> [ PARTITION BY <expr> [, ... ] ]
> [ ORDER BY <expr> [, ... ] ]
> [ MEASURES <expr> [AS] <alias> [, ... ] ]
> [ ONE ROW PER MATCH [ { SHOW TIMEOUT MATCHES } ] |
> ALL ROWS PER MATCH [ { SHOW TIMEOUT MATCHES } ]
> ]
> [ AFTER MATCH SKIP
> {
> PAST LAST ROW |
> TO NEXT ROW |
> TO [ { FIRST | LAST} ] <symbol>
> }
> ]
> PATTERN ( <pattern> )
> DEFINE <symbol> AS <expr> [, ... ]
> )
> {code}
> * 'SHOW TIMEOUT MATCHES' is introduce to add timeout matches to the output.
> *
--
This message was sent by Atlassian Jira
(v8.20.10#820010)