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_r253010974
##########
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:
Yes. It is also not good to have assumptions when we write a method like
that. It makes the code coupled with outside context that the assumptions are
based on. Ideally we should write methods which return correct results given
just inputs.
----------------------------------------------------------------
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]