JingGe commented on code in PR #24471:
URL: https://github.com/apache/flink/pull/24471#discussion_r1622617735


##########
flink-end-to-end-tests/flink-batch-sql-test/src/test/java/org/apache/flink/sql/tests/Generator.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.sql.tests;
+
+import org.apache.flink.connector.testframe.source.FromElementsSource;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.data.TimestampData;
+import org.apache.flink.types.Row;
+
+import java.time.Instant;
+import java.time.LocalDateTime;
+import java.time.ZoneOffset;
+import java.util.ArrayList;
+import java.util.List;
+
+class Generator implements FromElementsSource.ElementsSupplier<RowData> {
+    private static final long serialVersionUID = -8455653458083514261L;
+    private final List<Row> elements;
+
+    static Generator create(
+            int numKeys, float rowsPerKeyAndSecond, int durationSeconds, int 
offsetSeconds) {
+        final int stepMs = (int) (1000 / rowsPerKeyAndSecond);
+        final long durationMs = durationSeconds * 1000L;
+        final long offsetMs = offsetSeconds * 2000L;
+        final List<Row> elements = new ArrayList<>();
+        int keyIndex = 0;
+        long ms = 0;
+        while (ms < durationMs) {
+            elements.add(createRow(keyIndex++, ms, offsetMs));

Review Comment:
   The new implementation will consume more memory than the old one which will 
generate `row` iteratively on the fly. This could be a potential issue for 
large data volume batch tests. 



##########
flink-end-to-end-tests/flink-batch-sql-test/src/test/java/org/apache/flink/sql/tests/BatchSQLTest.java:
##########
@@ -34,66 +35,105 @@
 import org.apache.flink.table.sinks.CsvTableSink;
 import org.apache.flink.table.sources.InputFormatTableSource;
 import org.apache.flink.table.types.DataType;
+import org.apache.flink.test.junit5.MiniClusterExtension;
+import org.apache.flink.test.resources.ResourceTestUtils;
 import org.apache.flink.types.Row;
+import org.apache.flink.util.TestLoggerExtension;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.EnumSource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.Serializable;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.time.Instant;
 import java.time.LocalDateTime;
 import java.time.ZoneOffset;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
+import java.util.Optional;
+import java.util.UUID;
 
-/**
- * End-to-end test for batch SQL queries.
- *
- * <p>The sources are generated and bounded. The result is always constant.
- *
- * <p>Parameters: -outputPath output file path for CsvTableSink; -sqlStatement 
SQL statement that
- * will be executed as executeSql
- */
-public class BatchSQLTestProgram {
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/** End-to-End tests for Batch SQL tests. */
+@ExtendWith(TestLoggerExtension.class)
+public class BatchSQLTest {
+    private static final Logger LOG = 
LoggerFactory.getLogger(BatchSQLTest.class);
+
+    private static final Path sqlPath =
+            ResourceTestUtils.getResource("resources/sql-job-query.sql");
+
+    @TempDir private Path tmp;
+
+    @RegisterExtension
+    private static final MiniClusterExtension MINI_CLUSTER =
+            new MiniClusterExtension(
+                    new MiniClusterResourceConfiguration.Builder()
+                            .setNumberTaskManagers(2)
+                            .setNumberSlotsPerTaskManager(1)
+                            .build());
+
+    private Path result;
+
+    @BeforeEach
+    public void before() {
+        this.result = tmp.resolve(String.format("result-%s", 
UUID.randomUUID()));
+        LOG.info("Results for this test will be stored at: {}", this.result);
+    }
+
+    @ParameterizedTest
+    @EnumSource(
+            value = BatchShuffleMode.class,
+            names = {
+                "ALL_EXCHANGES_BLOCKING",

Review Comment:
   I think it makes sense to add comment that only `ALL_EXCHANGES_BLOCKING`,  
`ALL_EXCHANGES_HYBRID_FULL`, and `ALL_EXCHANGES_HYBRID_SELECTIVE` are supported 
by the adaptive batch scheduler. 



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