swuferhong commented on code in PR #20008:
URL: https://github.com/apache/flink/pull/20008#discussion_r914678263


##########
flink-formats/flink-parquet/src/test/java/org/apache/flink/formats/parquet/ParquetFileSystemStatisticsReportTest.java:
##########
@@ -0,0 +1,244 @@
+/*
+ * 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.formats.parquet;
+
+import org.apache.flink.table.api.TableConfig;
+import org.apache.flink.table.api.TableEnvironment;
+import org.apache.flink.table.plan.stats.ColumnStats;
+import org.apache.flink.table.plan.stats.TableStats;
+import org.apache.flink.table.planner.plan.schema.TableSourceTable;
+import org.apache.flink.table.planner.plan.stats.FlinkStatistic;
+import org.apache.flink.table.planner.runtime.utils.BatchTableEnvUtil;
+import org.apache.flink.table.planner.runtime.utils.TestData;
+import org.apache.flink.table.planner.utils.BatchTableTestUtil;
+import org.apache.flink.table.planner.utils.TableTestBase;
+import org.apache.flink.table.planner.utils.TableTestUtil;
+import org.apache.flink.util.Preconditions;
+
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.RelVisitor;
+import org.apache.calcite.rel.core.TableScan;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.sql.Date;
+import java.sql.Time;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Test for statistics functionality in {@link ParquetFileFormatFactory} in 
the case of file system
+ * source.
+ */
+public class ParquetFileSystemStatisticsReportTest extends TableTestBase {
+    private BatchTableTestUtil util;
+    private TableEnvironment tEnv;
+    private String path1;
+
+    @Before
+    public void setup() throws IOException {
+        util = batchTestUtil(TableConfig.getDefault());
+        tEnv = util.getTableEnv();
+        path1 = tempFolder().newFolder().toURI().getPath();
+
+        BatchTableEnvUtil.registerCollection(
+                tEnv,
+                "originalT",
+                TestData.buildInData(),
+                TestData.buildInType(),
+                "a,b,c,d,e,f,g,h,i,j");
+
+        String ddl1 =
+                String.format(
+                        "CREATE TABLE parquetFileSystemTable (\n"
+                                + "  a boolean,\n"
+                                + "  b tinyint,\n"
+                                + "  c int, \n"
+                                + "  d bigint, \n"
+                                + "  e double, \n"
+                                + "  f string, \n"
+                                + "  g decimal(14,2), \n"
+                                + "  h date, \n"
+                                + "  i time, \n"
+                                + "  j timestamp(3) \n"
+                                + ") with (\n"
+                                + " 'connector' = 'filesystem',"
+                                + " 'path' = '%s',"
+                                + "%s )",
+                        path1, String.join(",\n", formatProperties()));
+        tEnv.executeSql(ddl1);
+    }
+
+    private String[] formatProperties() {
+        List<String> ret = new ArrayList<>();
+        ret.add("'format'='parquet'");
+        ret.add("'parquet.utc-timezone'='true'");
+        ret.add("'parquet.compression'='gzip'");
+        return ret.toArray(new String[0]);
+    }
+
+    @Test
+    public void testParquetFileSystemStatisticsReportWithSingleFile()
+            throws ExecutionException, InterruptedException {
+        tEnv.executeSql(
+                        "insert into parquetFileSystemTable select a, b, c, d, 
e, f,"
+                                + " c * 3.14 as g, h, i, j"
+                                + " from originalT")

Review Comment:
   > please add some test for filters on DATE, TIME, TIMESTAMP_xxx, DECIMAL, 
which can check whether the value type is expected
   
   After modification, there is no select statement in these test cases. When 
there are select statement in other tests, I will add filters.



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

Reply via email to