dawidwys commented on code in PR #23821:
URL: https://github.com/apache/flink/pull/23821#discussion_r1412233154


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/stream/MatchRecognizeTestPrograms.java:
##########
@@ -0,0 +1,221 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.nodes.exec.stream;
+
+import org.apache.flink.table.test.program.SinkTestStep;
+import org.apache.flink.table.test.program.SourceTestStep;
+import org.apache.flink.table.test.program.TableTestProgram;
+import org.apache.flink.types.Row;
+
+/** {@link TableTestProgram} definitions for testing {@link StreamExecMatch}. 
*/
+public class MatchRecognizeTestPrograms {
+    static final Row[] SIMPLE_DATA = {
+        Row.of(1L, "a"),
+        Row.of(2L, "z"),
+        Row.of(3L, "b"),
+        Row.of(4L, "c"),
+        Row.of(5L, "d"),
+        Row.of(6L, "a"),
+        Row.of(7L, "b"),
+        Row.of(8L, "c"),
+        Row.of(9L, "a"),
+        Row.of(10L, "b")
+    };
+
+    static final Row[] SIMPLE_DATA2 = {Row.of(11L, "c")};
+
+    static final Row[] COMPLEX_DATA = {
+        Row.of("ACME", 1L, 19, 1),
+        Row.of("BETA", 2L, 18, 1),
+        Row.of("ACME", 3L, 17, 2),
+        Row.of("ACME", 4L, 13, 3),
+        Row.of("BETA", 5L, 16, 2),
+        Row.of("ACME", 6L, 20, 4)
+    };
+
+    static final Row[] COMPLEX_DATA2 = {Row.of("BETA", 7L, 22, 4)};
+
+    static final TableTestProgram SIMPLE_MATCH =
+            TableTestProgram.of("simple-match", "simple match recognize test")
+                    .setupTableSource(
+                            SourceTestStep.newBuilder("MyTable")
+                                    .addSchema(
+                                            "id bigint", "name varchar", 
"proctime as PROCTIME()")
+                                    .producedBeforeRestore(SIMPLE_DATA)
+                                    .producedAfterRestore(SIMPLE_DATA2)
+                                    .build())
+                    .setupTableSink(
+                            SinkTestStep.newBuilder("MySink")
+                                    .addSchema("a bigint", "b bigint", "c 
bigint")
+                                    .consumedBeforeRestore(Row.of(6L, 7L, 8L))
+                                    .consumedAfterRestore(Row.of(9L, 10L, 11L))
+                                    .build())
+                    .runSql(
+                            "insert into MySink"
+                                    + " SELECT T.aid, T.bid, T.cid\n"
+                                    + "     FROM MyTable MATCH_RECOGNIZE (\n"
+                                    + "             ORDER BY proctime\n"
+                                    + "             MEASURES\n"
+                                    + "             `A\"`.id AS aid,\n"
+                                    + "             \u006C.id AS bid,\n"
+                                    + "             C.id AS cid\n"
+                                    + "             PATTERN (`A\"` \u006C C)\n"
+                                    + "             DEFINE\n"
+                                    + "                 `A\"` AS name = 'a',\n"
+                                    + "                 \u006C AS name = 
'b',\n"
+                                    + "                 C AS name = 'c'\n"
+                                    + "     ) AS T")
+                    .build();
+
+    static final TableTestProgram COMPLEX_MATCH =
+            TableTestProgram.of("complex-match", "complex match recognize 
test")
+                    .setupTableSource(
+                            SourceTestStep.newBuilder("MyTable")
+                                    .addSchema(
+                                            "symbol string",
+                                            "tstamp bigint",
+                                            "price int",
+                                            "tax int",
+                                            "proctime as PROCTIME()")

Review Comment:
   > Sure. Does MR do anything different depending on rowtime vs proctime?
   
   Yes, substantially. Even if it didn't the restore tests serve two purposes 
now:
   * IT tests -> verify behaviour
   * **plan tests** -> verify serializability of the exec node
   
   > what do you mean be secondary sorting? Are you suggesting sorting 
"outside" the MR clause?
   
   I mean to sort in `ORDER BY` on additional columns besides the proctime



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to