You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/04/03 15:56:57 UTC

[GitHub] [spark] gengliangwang commented on a change in pull request #24284: [SPARK-27356][SQL] File source V2: Fix the case that data columns overlap with partition schema

gengliangwang commented on a change in pull request #24284: [SPARK-27356][SQL] File source V2: Fix the case that data columns overlap with partition schema
URL: https://github.com/apache/spark/pull/24284#discussion_r271814051
 
 

 ##########
 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 =>
+      attributeMap.get(getAttributeName(readAttr)).getOrElse {
+        throw new AnalysisException(s"Can't find required partition column ${readAttr.name} " +
+          s"in partition schema ${fileIndex.partitionSchema}")
+      }
+    }
+    lazy val partitionValueProject =
 
 Review comment:
   If this PR contains too many changes, I am OK to create a separate PR for the partition value pruning.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org