viirya commented on code in PR #36851:
URL: https://github.com/apache/spark/pull/36851#discussion_r906373236


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/SchemaPruning.scala:
##########
@@ -103,8 +104,14 @@ object SchemaPruning extends Rule[LogicalPlan] {
     }
   }
 
+  private def containsNestedColumn(fsRelation: HadoopFsRelation): Boolean =

Review Comment:
   Are you sure?
   
   I run `FileMetadataStructSuite` test with different pruning configurations:
   
   `SQLConf.NESTED_SCHEMA_PRUNING_ENABLED` = `false`:
   
   ```
   == Physical Plan ==
   *(1) Project [name#1884, age#1885, info#1886.id AS id#1890L, 
_metadata#1891.file_name AS file_name#1892]
   +- *(1) Project [name#1884, age#1885, info#1886, named_struct(file_name, 
file_name#1902) AS _metadata#1891]
      +- *(1) ColumnarToRow
         +- FileScan parquet [name#1884,age#1885,info#1886,file_name#1902] 
Batched: true, DataFilters: [], Format: Parquet, Location: InMemoryFileIndex(2 
paths)[file:/spark/target/tmp/spark-9e425a7e-5b6c-46aa..., PartitionFilters: 
[], PushedFilters: [], ReadSchema: 
struct<name:string,age:int,info:struct<id:bigint,university:string>>
   
   ```
   
   `SQLConf.NESTED_SCHEMA_PRUNING_ENABLED` = `true`:
   
   ```
   == Physical Plan ==
   *(1) Project [name#1884, age#1885, info#1886.id AS id#1890L, 
_metadata#1891.file_name AS file_name#1892]
   +- *(1) Project [name#1884, age#1885, info#1886, named_struct(file_name, 
file_name#1902) AS _metadata#1891]
      +- *(1) ColumnarToRow
         +- FileScan parquet [name#1884,age#1885,info#1886,file_name#1902] 
Batched: true, DataFilters: [], Format: Parquet, Location: InMemoryFileIndex(2 
paths)[file:/spark/target/tmp/spark-a0afa17b-52e7-4d1c..., PartitionFilters: 
[], PushedFilters: [], ReadSchema: 
struct<name:string,age:int,info:struct<id:bigint>>
   ```
   
   You can see `info` is pruned. But for `_metadata` column, it is always 
pruned and no difference between pruning/non-pruning cases.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to