You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/06/24 17:59:22 UTC

[GitHub] [spark] Yaohua628 commented on a diff in pull request #36851: [SPARK-39535][SQL] Make `SchemaPruning` only pruning if it contains nested column

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


##########
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:
   Maybe you can have one more check here "if it contains `_metadata`" using `FileSourceMetadataAttribute(attr)` and add a test for it? That would be great!



##########
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:
   I think it will break the schema pruning for the hidden metadata struct (`_metadata` is not in `fsRelation.schema` but `fsRelation.output`). 
   
   We actually have tests for that ([here](https://github.com/apache/spark/blob/master/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/FileMetadataStructSuite.scala#L431)): The reason why they didn't break is the test data itself luckily has a nested column ([here](https://github.com/apache/spark/blob/master/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/FileMetadataStructSuite.scala#L37)).



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org