@@ -0,0 +1,3125 @@
+/*%0A * Licensed to the Apache Software Foundation (ASF) under one%0A * or more contributor license agreements.  See the NOTICE file%0A * distributed with this work for additional information%0A * regarding copyright ownership.  The ASF licenses this file%0A * to you under the Apache License, Version 2.0 (the%0A * %22License%22); you may not use this file except in compliance%0A * with the License.  You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.apache.flink.table.connector.source.abilities;%0A%0Aimport org.apache.flink.annotation.PublicEvolving;%0Aimport org.apache.flink.table.connector.source.ScanTableSource;%0A%0Aimport java.util.List;%0A%0A/**%0A * Pushes dynamic filter into %7B@link ScanTableSource%7D, the table source can filter the partitions%0A * even the input data in runtime to reduce scan I/O.%0A *%0A * %3Cp%3EGiven the following SQL:%0A *%0A * %3Cpre%3E%7B@code%0A * SELECT * FROM partitioned_fact_table t1, non_partitioned_dim_table t2%0A *   WHERE t1.part_key = t2.col1 AND t2.col2 = 100%0A * %7D%3C/pre%3E%0A *%0A * %3Cp%3EIn the example above, %60partitioned_fact_table%60 is partition table whose partition key is%0A * %60part_key%60, and %60non_partitioned_dim_table%60 is a non-partition table which data contains all%0A * partition values of %60partitioned_fact_table%60. With the filter %7B@code t2.col2 = 100%7D, only a small%0A * part of the partitions need to be scanned out to do the join operation. The specific partitions%0A * is not available in the optimization phase but in the execution phase.%0A *%0A * %3Cp%3EUnlike %7B@link SupportsPartitionPushDown%7D, the conditions in the WHERE clause are analyzed to%0A * determine in advance which partitions can be safely skipped in the optimization phase. For such%0A * queries, the specific partitions is not available in the optimization phase but in the execution%0A * phase.%0A *%0A * %3Cp%3EBy default, if this interface is not implemented, the data is read entirely with a subsequent%0A * filter operation after the source.%0A *%0A * %3Cp%3EIf this interface is implemented, this interface just tells the source which fields can be%0A * applied for filtering and the source needs to pick the fields that can be supported and return%0A * them to planner. Then the planner will build the plan and construct the operator which will send%0A * the data to the source in runtime.%0A *%0A * %3Cp%3EIn the future, more flexible filtering can be pushed into the source connectors through this%0A * interface.%0A */%0A@PublicEvolving%0Apublic interface SupportsDynamicFiltering %7B%0A%0A    /**%0A     * Applies the candidate filter fields into the table source, and return the accepted fields.%0A     * The data corresponding the filter fields will be provided in runtime, which can be used to%0A     * filter the partitions or the input data.%0A     */%0A    List%3CString%3E applyDynamicFiltering(List%3CString%3E candidateFilterFields);%0A%7D%0A

Introduce SupportsDynamicFiltering