Re: [PR] [FLINK-33818] Implement restore tests for WindowDeduplicate node [flink]

2023-12-18 Thread via GitHub


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


##
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/stream/WindowDeduplicateTestPrograms.java:
##
@@ -0,0 +1,287 @@
+/*
+ * 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 
StreamExecWindowDeduplicate}. */
+public class WindowDeduplicateTestPrograms {
+
+static final Row[] BEFORE_DATA = {
+Row.of("2020-04-15 08:00:05", new BigDecimal(4.00), "A", "supplier1"),
+Row.of("2020-04-15 08:00:06", new BigDecimal(4.00), "A", "supplier2"),
+Row.of("2020-04-15 08:00:07", new BigDecimal(2.00), "G", "supplier1"),
+Row.of("2020-04-15 08:00:08", new BigDecimal(2.00), "A", "supplier3"),
+Row.of("2020-04-15 08:00:09", new BigDecimal(5.00), "D", "supplier4"),
+Row.of("2020-04-15 08:00:11", new BigDecimal(2.00), "B", "supplier3"),
+Row.of("2020-04-15 08:00:13", new BigDecimal(1.00), "E", "supplier1"),
+Row.of("2020-04-15 08:00:15", new BigDecimal(3.00), "B", "supplier2"),
+Row.of("2020-04-15 08:00:17", new BigDecimal(6.00), "D", "supplier5")
+};
+
+static final Row[] AFTER_DATA = {
+Row.of("2020-04-15 08:00:21", new BigDecimal(2.00), "B", "supplier7"),
+Row.of("2020-04-15 08:00:23", new BigDecimal(1.00), "A", "supplier4"),
+Row.of("2020-04-15 08:00:25", new BigDecimal(3.00), "C", "supplier3"),
+Row.of("2020-04-15 08:00:28", new BigDecimal(6.00), "A", "supplier8")
+};
+
+static final SourceTestStep SOURCE =
+SourceTestStep.newBuilder("bid_t")
+.addSchema(
+"ts STRING",
+"price DECIMAL(10,2)",
+"item STRING",
+"supplier_id STRING",
+"`bid_time` AS TO_TIMESTAMP(`ts`)",
+"`proc_time` AS PROCTIME()",
+"WATERMARK for `bid_time` AS `bid_time` - INTERVAL 
'1' SECOND")
+.producedBeforeRestore(BEFORE_DATA)
+.producedAfterRestore(AFTER_DATA)
+.build();
+
+static final String[] SINK_SCHEMA = {
+"bid_time TIMESTAMP(3)",
+"price DECIMAL(10,2)",
+"item STRING",
+"supplier_id STRING",
+"window_start TIMESTAMP(3)",
+"window_end TIMESTAMP(3)",
+"row_num BIGINT"
+};
+
+static final String TUMBLE_TVF =
+"TABLE(TUMBLE(TABLE bid_t, DESCRIPTOR(bid_time), INTERVAL '10' 
SECOND))";
+
+static final String HOP_TVF =
+"TABLE(HOP(TABLE bid_t, DESCRIPTOR(bid_time), INTERVAL '5' SECOND, 
INTERVAL '10' SECOND))";
+
+static final String CUMULATIVE_TVF =
+"TABLE(CUMULATE(TABLE bid_t, DESCRIPTOR(bid_time), INTERVAL '5' 
SECOND, INTERVAL '10' SECOND))";
+
+static final String ONE_ROW = "row_num <= 1";
+
+static final String N_ROWS = "row_num < 3";

Review Comment:
   Thank you for the update! LGTM now



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



Re: [PR] [FLINK-33818] Implement restore tests for WindowDeduplicate node [flink]

2023-12-18 Thread via GitHub


dawidwys merged PR #23923:
URL: https://github.com/apache/flink/pull/23923


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



Re: [PR] [FLINK-33818] Implement restore tests for WindowDeduplicate node [flink]

2023-12-15 Thread via GitHub


bvarghese1 commented on code in PR #23923:
URL: https://github.com/apache/flink/pull/23923#discussion_r1428333474


##
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/stream/WindowDeduplicateTestPrograms.java:
##
@@ -0,0 +1,287 @@
+/*
+ * 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 
StreamExecWindowDeduplicate}. */
+public class WindowDeduplicateTestPrograms {
+
+static final Row[] BEFORE_DATA = {
+Row.of("2020-04-15 08:00:05", new BigDecimal(4.00), "A", "supplier1"),
+Row.of("2020-04-15 08:00:06", new BigDecimal(4.00), "A", "supplier2"),
+Row.of("2020-04-15 08:00:07", new BigDecimal(2.00), "G", "supplier1"),
+Row.of("2020-04-15 08:00:08", new BigDecimal(2.00), "A", "supplier3"),
+Row.of("2020-04-15 08:00:09", new BigDecimal(5.00), "D", "supplier4"),
+Row.of("2020-04-15 08:00:11", new BigDecimal(2.00), "B", "supplier3"),
+Row.of("2020-04-15 08:00:13", new BigDecimal(1.00), "E", "supplier1"),
+Row.of("2020-04-15 08:00:15", new BigDecimal(3.00), "B", "supplier2"),
+Row.of("2020-04-15 08:00:17", new BigDecimal(6.00), "D", "supplier5")
+};
+
+static final Row[] AFTER_DATA = {
+Row.of("2020-04-15 08:00:21", new BigDecimal(2.00), "B", "supplier7"),
+Row.of("2020-04-15 08:00:23", new BigDecimal(1.00), "A", "supplier4"),
+Row.of("2020-04-15 08:00:25", new BigDecimal(3.00), "C", "supplier3"),
+Row.of("2020-04-15 08:00:28", new BigDecimal(6.00), "A", "supplier8")
+};
+
+static final SourceTestStep SOURCE =
+SourceTestStep.newBuilder("bid_t")
+.addSchema(
+"ts STRING",
+"price DECIMAL(10,2)",
+"item STRING",
+"supplier_id STRING",
+"`bid_time` AS TO_TIMESTAMP(`ts`)",
+"`proc_time` AS PROCTIME()",
+"WATERMARK for `bid_time` AS `bid_time` - INTERVAL 
'1' SECOND")
+.producedBeforeRestore(BEFORE_DATA)
+.producedAfterRestore(AFTER_DATA)
+.build();
+
+static final String[] SINK_SCHEMA = {
+"bid_time TIMESTAMP(3)",
+"price DECIMAL(10,2)",
+"item STRING",
+"supplier_id STRING",
+"window_start TIMESTAMP(3)",
+"window_end TIMESTAMP(3)",
+"row_num BIGINT"
+};
+
+static final String TUMBLE_TVF =
+"TABLE(TUMBLE(TABLE bid_t, DESCRIPTOR(bid_time), INTERVAL '10' 
SECOND))";
+
+static final String HOP_TVF =
+"TABLE(HOP(TABLE bid_t, DESCRIPTOR(bid_time), INTERVAL '5' SECOND, 
INTERVAL '10' SECOND))";
+
+static final String CUMULATIVE_TVF =
+"TABLE(CUMULATE(TABLE bid_t, DESCRIPTOR(bid_time), INTERVAL '5' 
SECOND, INTERVAL '10' SECOND))";
+
+static final String ONE_ROW = "row_num <= 1";
+
+static final String N_ROWS = "row_num < 3";

Review Comment:
   Yes, my bad. Will move this to the WindowRank PR.



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



Re: [PR] [FLINK-33818] Implement restore tests for WindowDeduplicate node [flink]

2023-12-15 Thread via GitHub


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


##
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/stream/WindowDeduplicateTestPrograms.java:
##
@@ -0,0 +1,287 @@
+/*
+ * 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 
StreamExecWindowDeduplicate}. */
+public class WindowDeduplicateTestPrograms {
+
+static final Row[] BEFORE_DATA = {
+Row.of("2020-04-15 08:00:05", new BigDecimal(4.00), "A", "supplier1"),
+Row.of("2020-04-15 08:00:06", new BigDecimal(4.00), "A", "supplier2"),
+Row.of("2020-04-15 08:00:07", new BigDecimal(2.00), "G", "supplier1"),
+Row.of("2020-04-15 08:00:08", new BigDecimal(2.00), "A", "supplier3"),
+Row.of("2020-04-15 08:00:09", new BigDecimal(5.00), "D", "supplier4"),
+Row.of("2020-04-15 08:00:11", new BigDecimal(2.00), "B", "supplier3"),
+Row.of("2020-04-15 08:00:13", new BigDecimal(1.00), "E", "supplier1"),
+Row.of("2020-04-15 08:00:15", new BigDecimal(3.00), "B", "supplier2"),
+Row.of("2020-04-15 08:00:17", new BigDecimal(6.00), "D", "supplier5")
+};
+
+static final Row[] AFTER_DATA = {
+Row.of("2020-04-15 08:00:21", new BigDecimal(2.00), "B", "supplier7"),
+Row.of("2020-04-15 08:00:23", new BigDecimal(1.00), "A", "supplier4"),
+Row.of("2020-04-15 08:00:25", new BigDecimal(3.00), "C", "supplier3"),
+Row.of("2020-04-15 08:00:28", new BigDecimal(6.00), "A", "supplier8")
+};
+
+static final SourceTestStep SOURCE =
+SourceTestStep.newBuilder("bid_t")
+.addSchema(
+"ts STRING",
+"price DECIMAL(10,2)",
+"item STRING",
+"supplier_id STRING",
+"`bid_time` AS TO_TIMESTAMP(`ts`)",
+"`proc_time` AS PROCTIME()",
+"WATERMARK for `bid_time` AS `bid_time` - INTERVAL 
'1' SECOND")
+.producedBeforeRestore(BEFORE_DATA)
+.producedAfterRestore(AFTER_DATA)
+.build();
+
+static final String[] SINK_SCHEMA = {
+"bid_time TIMESTAMP(3)",
+"price DECIMAL(10,2)",
+"item STRING",
+"supplier_id STRING",
+"window_start TIMESTAMP(3)",
+"window_end TIMESTAMP(3)",
+"row_num BIGINT"
+};
+
+static final String TUMBLE_TVF =
+"TABLE(TUMBLE(TABLE bid_t, DESCRIPTOR(bid_time), INTERVAL '10' 
SECOND))";
+
+static final String HOP_TVF =
+"TABLE(HOP(TABLE bid_t, DESCRIPTOR(bid_time), INTERVAL '5' SECOND, 
INTERVAL '10' SECOND))";
+
+static final String CUMULATIVE_TVF =
+"TABLE(CUMULATE(TABLE bid_t, DESCRIPTOR(bid_time), INTERVAL '5' 
SECOND, INTERVAL '10' SECOND))";
+
+static final String ONE_ROW = "row_num <= 1";
+
+static final String N_ROWS = "row_num < 3";

Review Comment:
   Is this still converted to `WindowDeduplicate`? I think it tests 
`WindowRank`, doesn't it? The json plans seem to confirm as I can not find the 
`WindowDeduplicate` node there.



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



Re: [PR] [FLINK-33818] Implement restore tests for WindowDeduplicate node [flink]

2023-12-13 Thread via GitHub


flinkbot commented on PR #23923:
URL: https://github.com/apache/flink/pull/23923#issuecomment-1854828911

   
   ## CI report:
   
   * e7fdab8bf875d961bf1e29830864d9ee5a0f455f UNKNOWN
   
   
   Bot commands
 The @flinkbot bot supports the following commands:
   
- `@flinkbot run azure` re-run the last Azure build
   


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