jnh5y commented on code in PR #23886:
URL: https://github.com/apache/flink/pull/23886#discussion_r1541896906


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/stream/WindowAggregateTestPrograms.java:
##########
@@ -0,0 +1,528 @@
+/*
+ * 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.api.config.OptimizerConfigOptions;
+import org.apache.flink.table.planner.utils.AggregatePhaseStrategy;
+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;
+
+import java.math.BigDecimal;
+import java.util.function.Function;
+
+/** {@link TableTestProgram} definitions for testing {@link 
StreamExecWindowAggregate}. */
+public class WindowAggregateTestPrograms {
+
+    static final Row[] BEFORE_DATA = {
+        Row.of("2020-10-10 00:00:01", 1, 1d, 1f, new BigDecimal("1.11"), "Hi", 
"a"),
+        Row.of("2020-10-10 00:00:02", 2, 2d, 2f, new BigDecimal("2.22"), 
"Comment#1", "a"),
+        Row.of("2020-10-10 00:00:03", 2, 2d, 2f, new BigDecimal("2.22"), 
"Comment#1", "a"),
+        Row.of("2020-10-10 00:00:04", 5, 5d, 5f, new BigDecimal("5.55"), null, 
"a"),
+        Row.of("2020-10-10 00:00:07", 3, 3d, 3f, null, "Hello", "b"),
+        // out of order
+        Row.of("2020-10-10 00:00:06", 6, 6d, 6f, new BigDecimal("6.66"), "Hi", 
"b"),
+        Row.of("2020-10-10 00:00:08", 3, null, 3f, new BigDecimal("3.33"), 
"Comment#2", "a"),
+        // late event
+        Row.of("2020-10-10 00:00:04", 5, 5d, null, new BigDecimal("5.55"), 
"Hi", "a"),
+        Row.of("2020-10-10 00:00:16", 4, 4d, 4f, new BigDecimal("4.44"), "Hi", 
"b"),
+        Row.of("2020-10-10 00:00:32", 7, 7d, 7f, new BigDecimal("7.77"), null, 
null),
+        Row.of("2020-10-10 00:00:34", 1, 3d, 3f, new BigDecimal("3.33"), 
"Comment#3", "b")
+    };
+
+    static final Row[] AFTER_DATA = {
+        Row.of("2020-10-10 00:00:40", 10, 3d, 3f, new BigDecimal("4.44"), 
"Comment#4", "a"),
+        Row.of("2020-10-10 00:00:42", 11, 4d, 4f, new BigDecimal("5.44"), 
"Comment#5", "d"),
+        Row.of("2020-10-10 00:00:43", 12, 5d, 5f, new BigDecimal("6.44"), 
"Comment#6", "c"),
+        Row.of("2020-10-10 00:00:44", 13, 6d, 6f, new BigDecimal("7.44"), 
"Comment#7", "d")
+    };
+
+    static final Function<String, SourceTestStep.Builder> SOURCE_BUILDER =
+            str ->
+                    SourceTestStep.newBuilder(str)
+                            .addSchema(
+                                    "ts STRING",
+                                    "a_int INT",
+                                    "b_double DOUBLE",
+                                    "c_float FLOAT",
+                                    "d_bigdec DECIMAL(10, 2)",
+                                    "`comment` STRING",
+                                    "name STRING",
+                                    "`rowtime` AS TO_TIMESTAMP(`ts`)",
+                                    "`proctime` AS PROCTIME()",
+                                    "WATERMARK for `rowtime` AS `rowtime` - 
INTERVAL '1' SECOND")
+                            .addOption("changelog-mode", "I,UA,UB,D")
+                            .producedBeforeRestore(BEFORE_DATA)
+                            .producedAfterRestore(AFTER_DATA);
+    static final SourceTestStep SOURCE = 
SOURCE_BUILDER.apply("window_source_t").build();
+
+    static final SourceTestStep CDC_SOURCE =
+            SOURCE_BUILDER
+                    .apply("cdc_window_source_t")
+                    .addOption("changelog-mode", "I,UA,UB,D")
+                    .build();

Review Comment:
   Ah, I made a mistake; removing the changelog for the SOURCE_BUILDER.
   
   Just to say it out loud, the CDC_SOURCE is set up to help cover some of the 
tests which @xuyangzhong added like this: 
https://github.com/apache/flink/blob/master/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/stream/WindowAggregateJsonPlanTest.java#L98
   
   Overall, there are several orthogonal options, and at some point, we should 
only test a subset of them.



-- 
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