cloud-fan commented on a change in pull request #24296: [SPARK-27384][SQL] File 
source V2: Prune unnecessary partition columns
URL: https://github.com/apache/spark/pull/24296#discussion_r272452462
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/FileScan.scala
 ##########
 @@ -40,7 +45,23 @@ abstract class FileScan(
   protected def partitions: Seq[FilePartition] = {
     val selectedPartitions = fileIndex.listFiles(Seq.empty, Seq.empty)
     val maxSplitBytes = FilePartition.maxSplitBytes(sparkSession, 
selectedPartitions)
+    val partitionAttributes = fileIndex.partitionSchema.toAttributes
+    val attributeMap = partitionAttributes.map(a => getAttributeName(a) -> 
a).toMap
+    val readPartitionAttributes = readPartitionSchema.toAttributes.map { 
readAttr =>
 
 Review comment:
   we should not create an attribute and just use its name. This can be
   ```
   readPartitionSchema.map { readField =>
     attributeMap.get(normalize(readField.name)).getOrElse ...
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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