HyukjinKwon 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_r252920483
##########
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:
@viirya, isn't `right` the schema of provided source? Yes, it looks we
should use `left` to project it later with correct nullability if I didn't
misread but looks logically it's going to set different nullability at
`hadoopFsRelation.copy(dataSchema = prunedDataSchema)` later.
I guess it won't be a big deal as long as it works but looks better we clean
here as well while we're here.
----------------------------------------------------------------
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]