Github user dbtsai commented on a diff in the pull request:
https://github.com/apache/spark/pull/22357#discussion_r216198335
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetSchemaPruning.scala
---
@@ -196,6 +201,9 @@ private[sql] object ParquetSchemaPruning extends
Rule[LogicalPlan] {
*/
private def getRootFields(expr: Expression): Seq[RootField] = {
expr match {
+ // Those expressions don't really use the nested fields of a root
field.
+ case i@(IsNotNull(_: Attribute) | IsNull(_: Attribute)) =>
+ getRootFields(i.children(0)).map(_.copy(contentAccessed = false))
case att: Attribute =>
RootField(StructField(att.name, att.dataType, att.nullable),
derivedFromAtt = true) :: Nil
case SelectedField(field) => RootField(field, derivedFromAtt =
false) :: Nil
--- End diff --
How about
```scala
case IsNotNull(_: Attribute) | IsNull(_: Attribute) =>
expr.children.flatMap(getRootFields).map(_.copy(contentAccessed =
false))
case _ =>
expr.children.flatMap(getRootFields)
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]