wanglijie95 commented on code in PR #22966:
URL: https://github.com/apache/flink/pull/22966#discussion_r1271379545


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/batch/sql/RuntimeFilterITCase.java:
##########
@@ -0,0 +1,213 @@
+/*
+ * 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.runtime.batch.sql;
+
+import org.apache.flink.api.common.BatchShuffleMode;
+import org.apache.flink.configuration.MemorySize;
+import org.apache.flink.table.api.TableEnvironment;
+import org.apache.flink.table.api.config.OptimizerConfigOptions;
+import org.apache.flink.table.catalog.ObjectPath;
+import org.apache.flink.table.catalog.stats.CatalogTableStatistics;
+import org.apache.flink.table.planner.factories.TestValuesCatalog;
+import org.apache.flink.table.planner.factories.TestValuesTableFactory;
+import 
org.apache.flink.table.planner.plan.optimize.program.FlinkRuntimeFilterProgramTest;
+import org.apache.flink.table.planner.runtime.utils.BatchTestBase;
+import org.apache.flink.table.planner.runtime.utils.TestData;
+import org.apache.flink.table.planner.utils.JavaScalaConversionUtil;
+import org.apache.flink.types.Row;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import java.util.Arrays;
+import java.util.stream.Stream;
+
+/** IT case for runtime filter. */
+class RuntimeFilterITCase extends BatchTestBase {
+
+    private final TestValuesCatalog catalog =
+            new TestValuesCatalog("testCatalog", "test_database", true);
+    private TableEnvironment tEnv;
+
+    static Stream<Arguments> parameters() {
+        return Stream.of(
+                Arguments.of(BatchShuffleMode.ALL_EXCHANGES_BLOCKING),
+                Arguments.of(BatchShuffleMode.ALL_EXCHANGES_PIPELINED));
+    }
+
+    @BeforeEach
+    @Override
+    public void before() throws Exception {
+        super.before();
+        tEnv = tEnv();
+        catalog.open();
+        tEnv.registerCatalog("testCatalog", catalog);
+        tEnv.useCatalog("testCatalog");
+        
tEnv.getConfig().set(OptimizerConfigOptions.TABLE_OPTIMIZER_RUNTIME_FILTER_ENABLED,
 true);
+        tEnv.getConfig()
+                .set(
+                        
OptimizerConfigOptions.TABLE_OPTIMIZER_RUNTIME_FILTER_MAX_BUILD_DATA_SIZE,
+                        MemorySize.parse("10m"));
+        tEnv.getConfig()

Review Comment:
   Fixed



##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/batch/sql/RuntimeFilterITCase.java:
##########
@@ -0,0 +1,213 @@
+/*
+ * 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.runtime.batch.sql;
+
+import org.apache.flink.api.common.BatchShuffleMode;
+import org.apache.flink.configuration.MemorySize;
+import org.apache.flink.table.api.TableEnvironment;
+import org.apache.flink.table.api.config.OptimizerConfigOptions;
+import org.apache.flink.table.catalog.ObjectPath;
+import org.apache.flink.table.catalog.stats.CatalogTableStatistics;
+import org.apache.flink.table.planner.factories.TestValuesCatalog;
+import org.apache.flink.table.planner.factories.TestValuesTableFactory;
+import 
org.apache.flink.table.planner.plan.optimize.program.FlinkRuntimeFilterProgramTest;
+import org.apache.flink.table.planner.runtime.utils.BatchTestBase;
+import org.apache.flink.table.planner.runtime.utils.TestData;
+import org.apache.flink.table.planner.utils.JavaScalaConversionUtil;
+import org.apache.flink.types.Row;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import java.util.Arrays;
+import java.util.stream.Stream;
+
+/** IT case for runtime filter. */
+class RuntimeFilterITCase extends BatchTestBase {
+
+    private final TestValuesCatalog catalog =
+            new TestValuesCatalog("testCatalog", "test_database", true);
+    private TableEnvironment tEnv;
+
+    static Stream<Arguments> parameters() {
+        return Stream.of(
+                Arguments.of(BatchShuffleMode.ALL_EXCHANGES_BLOCKING),
+                Arguments.of(BatchShuffleMode.ALL_EXCHANGES_PIPELINED));
+    }
+
+    @BeforeEach
+    @Override
+    public void before() throws Exception {
+        super.before();
+        tEnv = tEnv();
+        catalog.open();
+        tEnv.registerCatalog("testCatalog", catalog);
+        tEnv.useCatalog("testCatalog");
+        
tEnv.getConfig().set(OptimizerConfigOptions.TABLE_OPTIMIZER_RUNTIME_FILTER_ENABLED,
 true);
+        tEnv.getConfig()
+                .set(
+                        
OptimizerConfigOptions.TABLE_OPTIMIZER_RUNTIME_FILTER_MAX_BUILD_DATA_SIZE,
+                        MemorySize.parse("10m"));
+        tEnv.getConfig()
+                .set(
+                        
OptimizerConfigOptions.TABLE_OPTIMIZER_RUNTIME_FILTER_MIN_PROBE_DATA_SIZE,
+                        MemorySize.parse("10g"));
+        tEnv.getConfig()
+                
.set(OptimizerConfigOptions.TABLE_OPTIMIZER_RUNTIME_FILTER_MIN_FILTER_RATIO, 
0.5);
+
+        tEnv.executeSql(
+                String.format(
+                        "CREATE TABLE dim (\n"
+                                + "  x INT,\n"
+                                + "  y INT,\n"
+                                + "  z BIGINT\n"
+                                + ")  WITH (\n"
+                                + " 'connector' = 'values',\n"
+                                + " 'disable-lookup' = 'true',\n"
+                                + " 'data-id' = '%s',\n"
+                                + " 'bounded' = 'true'\n"
+                                + ")",
+                        
TestValuesTableFactory.registerData(TestData.data7())));
+
+        tEnv.executeSql(
+                String.format(
+                        "CREATE TABLE fact (\n"
+                                + "  `a` INT,\n"
+                                + "  `b` BIGINT,\n"
+                                + "  `c` INT,\n"
+                                + "  `d` VARCHAR,\n"
+                                + "  `e` BIGINT\n"
+                                + ") WITH (\n"
+                                + "  'connector' = 'values',\n"
+                                + "  'runtime-source' = 'NewSource',\n"
+                                + "  'data-id' = '%s',\n"
+                                + "  'disable-lookup' = 'true',\n"
+                                + "  'bounded' = 'true'\n"
+                                + ")",
+                        
TestValuesTableFactory.registerData(TestData.data5())));
+
+        // note that we set the row count here so that the runtime filter can 
take effect
+        // it is not the real data volume of the table
+        catalog.alterTableStatistics(
+                new ObjectPath(tEnv.getCurrentDatabase(), "dim"),
+                new CatalogTableStatistics(
+                        FlinkRuntimeFilterProgramTest.SUITABLE_DIM_ROW_COUNT, 
1, 1, 1),
+                false);
+        catalog.alterTableStatistics(
+                new ObjectPath(tEnv.getCurrentDatabase(), "fact"),
+                new CatalogTableStatistics(
+                        FlinkRuntimeFilterProgramTest.SUITABLE_FACT_ROW_COUNT, 
1, 1, 1),
+                false);
+    }
+
+    @ParameterizedTest(name = "mode = {0}")
+    @MethodSource("parameters")
+    void testSimpleRuntimeFilter(BatchShuffleMode shuffleMode) {

Review Comment:
   Yes, have checked.



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