[
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, opposite of 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 introduced to add timeout matches to the output.
* [^ <symbol>] is proposed in <pattern> to express the notNext semantic. For
example, A [^B] is translated to A.notNext(B).
* ?? is introduced in <pattern> to support the opposite of consecutive
semantic. For example, A B+?? is translated to A.next(B).oneOrMore(). On the
contrary, A B+ is translated to A.next(B).oneOrMore().consecutive().
* {<symbol>} is proposed in <pattern> to represent the until semantic. For
example, A {- B*? -} C+{D} is translated to
A.followedBy(C).oneOrMore().until(D).
was:
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.
*
> 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, opposite of 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 introduced to add timeout matches to the output.
> * [^ <symbol>] is proposed in <pattern> to express the notNext semantic. For
> example, A [^B] is translated to A.notNext(B).
> * ?? is introduced in <pattern> to support the opposite of consecutive
> semantic. For example, A B+?? is translated to A.next(B).oneOrMore(). On the
> contrary, A B+ is translated to A.next(B).oneOrMore().consecutive().
> * {<symbol>} is proposed in <pattern> to represent the until semantic. For
> example, A {- B*? -} C+{D} is translated to
> A.followedBy(C).oneOrMore().until(D).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)