@@ -0,0 +1,2376 @@
+/*%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.format;%0A%0Aimport org.apache.flink.annotation.PublicEvolving;%0Aimport org.apache.flink.core.fs.Path;%0Aimport org.apache.flink.table.connector.source.abilities.SupportsStatisticReport;%0Aimport org.apache.flink.table.plan.stats.TableStats;%0Aimport org.apache.flink.table.types.DataType;%0A%0Aimport java.util.List;%0A%0A/**%0A * Extension of input format which is able to report estimated statistics for file based connector.%0A *%0A * %3Cp%3EThis interface is used by file-based connectors which should also implement %7B@link%0A * SupportsStatisticReport%7D. Since file have different formats, and each format has a different way%0A * of storing and obtaining statistics information. For example: for Parquet and Orc, they both%0A * store the metadata information in the file footer, which including row count, max/min, null%0A * count, etc. While, for csv, there is no other metadata information excluding file size, one%0A * approach to estimate row count is: the entire file size divided by the average length of the%0A * sampled rows.%0A *%0A * %3Cp%3ENote: This method is called at plan optimization phase, the implementation of this interface%0A * should be as light as possible, but more complete information.%0A */%0A@PublicEvolving%0Apublic interface FileBasedStatisticsReportableInputFormat %7B%0A%0A    /**%0A     * Returns the estimated statistics of this input format.%0A     *%0A     * @param files The files to be estimated.%0A     * @param producedDataType the final output type of the format.%0A     */%0A    TableStats reportStatistics(List%3CPath%3E files, DataType producedDataType);%0A%7D%0A

Introduce FileBasedStatisticsReportableInputFormat interface