summaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/match_recognize/drop_out_of_order.yql
blob: 1ecaa285898114b3d1ced58d4b067375abc9d996 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
PRAGMA FeatureR010="prototype";
pragma config.flags("TimeOrderRecoverDelay", "-11");
pragma config.flags("TimeOrderRecoverAhead", "11");
PRAGMA config.flags("MatchRecognizeStream", "force");

$input = SELECT * FROM AS_TABLE([
    <|time: 10, name: "A"|>,
    <|time: 20, name: "B"|>,
    <|time: 30, name: "A"|>,
    <|time: 0,  name: "B"|>,
]);

SELECT * FROM $input MATCH_RECOGNIZE(
    ORDER BY CAST(time as Timestamp)
    MEASURES
        FIRST(A.time) AS a_time,
        LAST(B.time)  AS b_time
    PATTERN (A B)
    DEFINE
        A AS A.name = "A",
        B AS B.name = "B"
);