lsyldliu commented on code in PR #23771:
URL: https://github.com/apache/flink/pull/23771#discussion_r1422369948
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/processor/utils/InputPriorityConflictResolverTest.java:
##########
@@ -30,19 +33,43 @@
import
org.apache.flink.table.planner.plan.nodes.exec.spec.DynamicTableSourceSpec;
import org.apache.flink.table.types.logical.IntType;
import org.apache.flink.table.types.logical.RowType;
+import org.apache.flink.testutils.junit.extensions.parameterized.Parameter;
+import
org.apache.flink.testutils.junit.extensions.parameterized.ParameterizedTestExtension;
+import org.apache.flink.testutils.junit.extensions.parameterized.Parameters;
-import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.Optional;
import java.util.function.Consumer;
import static org.assertj.core.api.Assertions.assertThat;
/** Tests for {@link InputPriorityConflictResolver}. */
+@ExtendWith(ParameterizedTestExtension.class)
class InputPriorityConflictResolverTest {
- @Test
+ @Parameter
+ public Tuple2<BatchShuffleMode, StreamExchangeMode>
batchShuffleModeAndStreamExchangeMode;
+
+ @Parameters(name = "batchShuffleModeAndStreamExchangeMode={0}")
+ public static Collection<Tuple2<BatchShuffleMode, StreamExchangeMode>>
parameters() {
+ return Arrays.asList(
+ Tuple2.of(BatchShuffleMode.ALL_EXCHANGES_BLOCKING,
StreamExchangeMode.BATCH),
+ Tuple2.of(BatchShuffleMode.ALL_EXCHANGES_HYBRID_FULL,
StreamExchangeMode.BATCH),
Review Comment:
I have one question: what is the purpose of this case test?
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/optimize/program/ShuffleModePlanOptimizeTest.java:
##########
@@ -0,0 +1,127 @@
+/*
+ * 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.optimize.program;
+
+import org.apache.flink.api.common.BatchShuffleMode;
+import org.apache.flink.configuration.ExecutionOptions;
+import org.apache.flink.table.api.TableConfig;
+import org.apache.flink.table.api.config.OptimizerConfigOptions;
+import org.apache.flink.table.planner.factories.TestValuesCatalog;
+import org.apache.flink.table.planner.utils.BatchTableTestUtil;
+import org.apache.flink.table.planner.utils.TableTestBase;
+import org.apache.flink.testutils.junit.extensions.parameterized.Parameter;
+import
org.apache.flink.testutils.junit.extensions.parameterized.ParameterizedTestExtension;
+import org.apache.flink.testutils.junit.extensions.parameterized.Parameters;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+/** Test optimized plans for different shuffle mode. */
+@ExtendWith(ParameterizedTestExtension.class)
+class ShuffleModePlanOptimizeTest extends TableTestBase {
+
+ @Parameters(name = "mode = {0}")
+ public static Collection<BatchShuffleMode> parameters() {
+ return Arrays.asList(
+ BatchShuffleMode.ALL_EXCHANGES_BLOCKING,
+ BatchShuffleMode.ALL_EXCHANGES_HYBRID_SELECTIVE,
+ BatchShuffleMode.ALL_EXCHANGES_HYBRID_FULL);
+ }
+
+ @Parameter public BatchShuffleMode mode;
+
+ private final BatchTableTestUtil util =
batchTestUtil(TableConfig.getDefault());
+ private final TestValuesCatalog catalog =
+ new TestValuesCatalog("testCatalog", "test_database", true);
+
+ @BeforeEach
+ void setup() {
+ catalog.open();
+ util.tableEnv().registerCatalog("testCatalog", catalog);
+ util.tableEnv().useCatalog("testCatalog");
+ TableConfig tableConfig = util.tableEnv().getConfig();
+
tableConfig.set(OptimizerConfigOptions.TABLE_OPTIMIZER_DYNAMIC_FILTERING_ENABLED,
true);
+ if (mode != null) {
+ tableConfig.set(ExecutionOptions.BATCH_SHUFFLE_MODE, mode);
+ }
+
+ // partition fact table.
+ util.tableEnv()
+ .executeSql(
+ "CREATE TABLE fact_part (\n"
+ + " id BIGINT,\n"
+ + " name STRING,\n"
+ + " amount BIGINT,\n"
+ + " price BIGINT,\n"
+ + " fact_date_sk BIGINT\n"
+ + ") PARTITIONED BY (fact_date_sk)\n"
+ + "WITH (\n"
+ + " 'connector' = 'values',\n"
+ + " 'runtime-source' = 'NewSource',\n"
+ + " 'partition-list' =
'fact_date_sk:1990;fact_date_sk:1991;fact_date_sk:1992',\n"
+ + " 'dynamic-filtering-fields' =
'fact_date_sk;amount',\n"
+ + " 'bounded' = 'true'\n"
+ + ")");
+
+ // dim table.
+ util.tableEnv()
+ .executeSql(
+ "CREATE TABLE dim (\n"
+ + " id BIGINT,\n"
+ + " male BOOLEAN,\n"
+ + " amount BIGINT,\n"
+ + " price BIGINT,\n"
+ + " dim_date_sk BIGINT\n"
+ + ") WITH (\n"
+ + " 'connector' = 'values',\n"
+ + " 'runtime-source' = 'NewSource',\n"
+ + " 'bounded' = 'true'\n"
+ + ")");
+ }
+
+ @TestTemplate
+ void testSimpleDimJoin() {
Review Comment:
It would be better rename it to `testMultipleInputWithDPP`
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/optimize/program/ShuffleModePlanOptimizeTest.java:
##########
@@ -0,0 +1,127 @@
+/*
+ * 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.optimize.program;
+
+import org.apache.flink.api.common.BatchShuffleMode;
+import org.apache.flink.configuration.ExecutionOptions;
+import org.apache.flink.table.api.TableConfig;
+import org.apache.flink.table.api.config.OptimizerConfigOptions;
+import org.apache.flink.table.planner.factories.TestValuesCatalog;
+import org.apache.flink.table.planner.utils.BatchTableTestUtil;
+import org.apache.flink.table.planner.utils.TableTestBase;
+import org.apache.flink.testutils.junit.extensions.parameterized.Parameter;
+import
org.apache.flink.testutils.junit.extensions.parameterized.ParameterizedTestExtension;
+import org.apache.flink.testutils.junit.extensions.parameterized.Parameters;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+/** Test optimized plans for different shuffle mode. */
+@ExtendWith(ParameterizedTestExtension.class)
+class ShuffleModePlanOptimizeTest extends TableTestBase {
+
+ @Parameters(name = "mode = {0}")
+ public static Collection<BatchShuffleMode> parameters() {
+ return Arrays.asList(
+ BatchShuffleMode.ALL_EXCHANGES_BLOCKING,
+ BatchShuffleMode.ALL_EXCHANGES_HYBRID_SELECTIVE,
+ BatchShuffleMode.ALL_EXCHANGES_HYBRID_FULL);
+ }
+
+ @Parameter public BatchShuffleMode mode;
+
+ private final BatchTableTestUtil util =
batchTestUtil(TableConfig.getDefault());
+ private final TestValuesCatalog catalog =
+ new TestValuesCatalog("testCatalog", "test_database", true);
+
+ @BeforeEach
+ void setup() {
+ catalog.open();
+ util.tableEnv().registerCatalog("testCatalog", catalog);
+ util.tableEnv().useCatalog("testCatalog");
+ TableConfig tableConfig = util.tableEnv().getConfig();
+
tableConfig.set(OptimizerConfigOptions.TABLE_OPTIMIZER_DYNAMIC_FILTERING_ENABLED,
true);
+ if (mode != null) {
+ tableConfig.set(ExecutionOptions.BATCH_SHUFFLE_MODE, mode);
+ }
+
+ // partition fact table.
+ util.tableEnv()
+ .executeSql(
+ "CREATE TABLE fact_part (\n"
+ + " id BIGINT,\n"
+ + " name STRING,\n"
+ + " amount BIGINT,\n"
+ + " price BIGINT,\n"
+ + " fact_date_sk BIGINT\n"
+ + ") PARTITIONED BY (fact_date_sk)\n"
+ + "WITH (\n"
+ + " 'connector' = 'values',\n"
+ + " 'runtime-source' = 'NewSource',\n"
+ + " 'partition-list' =
'fact_date_sk:1990;fact_date_sk:1991;fact_date_sk:1992',\n"
+ + " 'dynamic-filtering-fields' =
'fact_date_sk;amount',\n"
+ + " 'bounded' = 'true'\n"
+ + ")");
+
+ // dim table.
+ util.tableEnv()
+ .executeSql(
+ "CREATE TABLE dim (\n"
+ + " id BIGINT,\n"
+ + " male BOOLEAN,\n"
+ + " amount BIGINT,\n"
+ + " price BIGINT,\n"
+ + " dim_date_sk BIGINT\n"
+ + ") WITH (\n"
+ + " 'connector' = 'values',\n"
+ + " 'runtime-source' = 'NewSource',\n"
+ + " 'bounded' = 'true'\n"
+ + ")");
+ }
+
+ @TestTemplate
+ void testSimpleDimJoin() {
+ String query =
+ "SELECT * FROM"
+ + " (Select count(*) c1 from fact_part, dim "
+ + "where fact_part.fact_date_sk = dim_date_sk and
fact_part.price < 100) s1,"
+ + " (Select count(*) c2 from fact_part, dim "
+ + "where fact_part.fact_date_sk = dim_date_sk and
dim.price < 200) s2,"
+ + " (Select count(*) c3 from fact_part, dim "
+ + "where fact_part.fact_date_sk = dim_date_sk and
dim.price < 400) s3";
+ util.verifyExecPlan(query);
+ }
+
+ @TestTemplate
+ void testMultiInputReplaceNestedLoopJoin() {
Review Comment:
Renaming it to `testMultipleInputWithoutDPP`
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/optimize/program/ShuffleModePlanOptimizeTest.java:
##########
@@ -0,0 +1,127 @@
+/*
+ * 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.optimize.program;
+
+import org.apache.flink.api.common.BatchShuffleMode;
+import org.apache.flink.configuration.ExecutionOptions;
+import org.apache.flink.table.api.TableConfig;
+import org.apache.flink.table.api.config.OptimizerConfigOptions;
+import org.apache.flink.table.planner.factories.TestValuesCatalog;
+import org.apache.flink.table.planner.utils.BatchTableTestUtil;
+import org.apache.flink.table.planner.utils.TableTestBase;
+import org.apache.flink.testutils.junit.extensions.parameterized.Parameter;
+import
org.apache.flink.testutils.junit.extensions.parameterized.ParameterizedTestExtension;
+import org.apache.flink.testutils.junit.extensions.parameterized.Parameters;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+/** Test optimized plans for different shuffle mode. */
+@ExtendWith(ParameterizedTestExtension.class)
+class ShuffleModePlanOptimizeTest extends TableTestBase {
Review Comment:
This test class isn't used to test `FlinkOptimizeProgram`, so removing it
from the program package would be better.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]