lsyldliu commented on code in PR #21563: URL: https://github.com/apache/flink/pull/21563#discussion_r1059217459
########## flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveTableSourceITCase.java: ########## @@ -447,6 +447,51 @@ public void testProjectionPushDown() throws Exception { } } + @Test + public void testReadParquetNestedPushdown() throws Exception { + batchTableEnv.executeSql( + "create table parquet_complex_type_test(" + + "a array<struct<a1:int>>, " + + "m map<int,string>, " + + "s struct<f1:int,`f2.q1`:bigint,f3:DECIMAL(5,4), f4:struct<f5:string>>" Review Comment: Can we define the `f4` as `f4:struct<f5:string, f6: string>`? then we just select the `f5` field. ########## flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveTableSourceITCase.java: ########## @@ -447,6 +447,51 @@ public void testProjectionPushDown() throws Exception { } } + @Test + public void testReadParquetNestedPushdown() throws Exception { + batchTableEnv.executeSql( + "create table parquet_complex_type_test(" + + "a array<struct<a1:int>>, " + + "m map<int,string>, " + + "s struct<f1:int,`f2.q1`:bigint,f3:DECIMAL(5,4), f4:struct<f5:string>>" + + ") partitioned by (p1 int) " + + "stored as parquet"); + String[] modules = batchTableEnv.listModules(); + // load hive module so that we can use array,map, named_struct function + // for convenient writing complex data + batchTableEnv.loadModule("hive", new HiveModule()); + batchTableEnv.useModules("hive", CoreModuleFactory.IDENTIFIER); + + batchTableEnv + .executeSql( + "insert into parquet_complex_type_test" + + " select array(named_struct('a1',1), named_struct('a1',2)), map(1, 'val1', 2, 'val2')," + + " named_struct('f1', 1, '`f2.q1`', 2, 'f3', 1.1, 'f4', named_struct('f5','1')), 1" + + " union all" + + " select array(named_struct('a1',3), named_struct('a1',4)), map(3, 'val1', 4, 'val2')," + + " named_struct('f1', 3, '`f2.q1`', 4, 'f3', 1.2, 'f4', named_struct('f5','2')), 2" + + " union all" + + " select array(named_struct('a1',5), named_struct('a1',6)), map(5, 'val1', 6, 'val2')," + + " named_struct('f1', 4, '`f2.q1`', 5, 'f3', 1.3, 'f4', named_struct('f5','3')), 3" + + " ") + .await(); + Table table = + batchTableEnv.sqlQuery( + "select s.`f2.q1`, s.f4.f5, p1 from parquet_complex_type_test where isnull(s.f4.f5) is not true and s.f4 is not null and s.`f2.q1` >= 4 and s.f3 >= 1.2"); + String[] explain = table.explain().split("==.*==\n"); Review Comment: Please refer to the test `HiveDialectQueryITCase#testMultiInsert`, writing the plan to `.out` file, it maybe more clear. ########## flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveTableSourceITCase.java: ########## @@ -447,6 +447,51 @@ public void testProjectionPushDown() throws Exception { } } + @Test + public void testReadParquetNestedPushdown() throws Exception { Review Comment: Your changes also cover the lookup table source, so I think we should also add a lookup projection pushdown test? -- 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