viirya commented on a change in pull request #23719: [SPARK-26808][SQL] Pruned 
schema should not change nullability
URL: https://github.com/apache/spark/pull/23719#discussion_r252921221
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetSchemaPruning.scala
 ##########
 @@ -280,7 +280,7 @@ private[sql] object ParquetSchemaPruning extends 
Rule[LogicalPlan] {
           val leftFieldType = leftStruct(fieldName).dataType
           val rightFieldType = rightStruct(fieldName).dataType
           val sortedLeftFieldType = sortLeftFieldsByRight(leftFieldType, 
rightFieldType)
-          StructField(fieldName, sortedLeftFieldType)
+          StructField(fieldName, sortedLeftFieldType, nullable = 
leftStruct(fieldName).nullable)
 
 Review comment:
   The `right` and `left` should have the same nullability as `left` is pruned 
version of `right`. As here it sorts the fields in `left` so I use `left` 
nullability.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to