Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/22357#discussion_r216601125
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetSchemaPruning.scala
 ---
    @@ -110,7 +110,17 @@ private[sql] object ParquetSchemaPruning extends 
Rule[LogicalPlan] {
         val projectionRootFields = projects.flatMap(getRootFields)
         val filterRootFields = filters.flatMap(getRootFields)
     
    -    (projectionRootFields ++ filterRootFields).distinct
    +    // Kind of expressions don't need to access any fields of a root 
fields, e.g., `IsNotNull`.
    +    // For them, if there are any nested fields accessed in the query, we 
don't need to add root
    +    // field access of above expressions.
    +    // For example, for a query `SELECT name.first FROM contacts WHERE 
name IS NOT NULL`,
    +    // we don't need to read nested fields of `name` struct other than 
`first` field.
    --- End diff --
    
    A complex column is null and its fields are null are different. I think we 
don't need to read all the fields to check if the complex column is null. In 
other words, in above case, when we only read `employer.id` and it is null, the 
predicate `employer is not null` will still be true because it is a complex 
column containing a null field.


---

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

Reply via email to