Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4792#discussion_r25554933
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/parquet/newParquet.scala ---
    @@ -483,16 +487,42 @@ private[sql] case class ParquetRelation2(
     
             val requiredPartOrdinal = partitionKeyLocations.keys.toSeq
     
    -        iterator.map { pair =>
    -          val row = pair._2.asInstanceOf[SpecificMutableRow]
    -          var i = 0
    -          while (i < requiredPartOrdinal.size) {
    -            // TODO Avoids boxing cost here!
    -            val partOrdinal = requiredPartOrdinal(i)
    -            row.update(partitionKeyLocations(partOrdinal), 
partValues(partOrdinal))
    -            i += 1
    +        if (primitiveRow) {
    +          iterator.map { pair =>
    +            // We are using CatalystPrimitiveRowConverter and it returns a 
SpecificMutableRow.
    +            val row = pair._2.asInstanceOf[SpecificMutableRow]
    +            var i = 0
    +            while (i < requiredPartOrdinal.size) {
    +              // TODO Avoids boxing cost here!
    +              val partOrdinal = requiredPartOrdinal(i)
    +              row.update(partitionKeyLocations(partOrdinal), 
partValues(partOrdinal))
    +              i += 1
    +            }
    +            row
    +          }
    +        } else {
    +          // Create a mutable row since we need to fill in values from 
partition columns.
    +          val mutableRow = new GenericMutableRow(requestedSchema.size)
    --- End diff --
    
    This is not necessary. Unlike `output.size` in `ParquetTableScan`, 
`requestedSchema` here is already a local variable.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to