jnh5y commented on code in PR #23879: URL: https://github.com/apache/flink/pull/23879#discussion_r1417587636
########## flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/stream/TemporalSortTestPrograms.java: ########## @@ -0,0 +1,103 @@ +/* + * 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; + +import java.math.BigDecimal; + +/** {@link TableTestProgram} definitions for testing {@link StreamExecTemporalSort}. */ +public class TemporalSortTestPrograms { + + 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:07", 5, 6d, 3f, null, "Hello", "b"), + 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") + }; + + 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") + }; + static final TableTestProgram TEMPORAL_SORT_PROCTIME = + TableTestProgram.of( + "temporal-sort-proctime", "validates temporal sort node with proctime") + .setupTableSource( + SourceTestStep.newBuilder("source_t") + .addSchema( + "a INT", + "b BIGINT", + "c STRING", + "`proctime` as PROCTIME()") + .producedBeforeRestore( + Row.of(1, 1L, "Hi"), + Row.of(2, 2L, "Hello"), + Row.of(3, 2L, "Hello world")) + .producedAfterRestore( + Row.of(4, 1L, "Guten Morgen"), + Row.of(5, 2L, "Guten Tag")) + .build()) + .setupTableSink( + SinkTestStep.newBuilder("sink_t") + .addSchema("a INT") + .consumedBeforeRestore("+I[1]", "+I[2]", "+I[3]") + .consumedAfterRestore("+I[4]", "+I[5]") + .build()) + .runSql("INSERT INTO sink_t SELECT a from source_t ORDER BY proctime") + .build(); + + static final TableTestProgram TEMPORAL_SORT_ROWTIME = + TableTestProgram.of( + "temporal-sort-rowtime", "validates temporal sort node with rowtime") + .setupTableSource( + SourceTestStep.newBuilder("source_t") + .addSchema( + "ts STRING", + "`int` INT", + "`double` DOUBLE", + "`float` FLOAT", + "`bigdec` DECIMAL(10, 2)", + "`string` STRING", + "`name` STRING", + "`rowtime` AS TO_TIMESTAMP(`ts`)", + "WATERMARK for `rowtime` AS `rowtime` - INTERVAL '1' SECOND") Review Comment: From an offline discussion, we decided on 3. -- 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