Skip to content

Commit 24928ea

Browse files
author
Anselme Vignon
committed
corrected mirror bug (see SPARK-5775) for newParquet
1 parent 7c829cb commit 24928ea

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

sql/core/src/main/scala/org/apache/spark/sql/parquet/newParquet.scala

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,18 @@ case class ParquetRelation2(path: String)(@transient val sqlContext: SQLContext)
278278
}.toMap
279279

280280
val currentValue = partValues.values.head.toInt
281-
iter.map { pair =>
282-
val res = pair._2.asInstanceOf[SpecificMutableRow]
283-
res.setInt(partitionKeyLocation, currentValue)
284-
res
281+
iter.map { _._2 match {
282+
case row: SpecificMutableRow => {
283+
val res = row.asInstanceOf[SpecificMutableRow]
284+
res.setInt(partitionKeyLocation, currentValue)
285+
res
286+
}
287+
case row: Row => {
288+
val rowContent = row.to[Array]
289+
rowContent.update(partitionKeyLocation, currentValue)
290+
Row.fromSeq(rowContent)
291+
}
292+
}
285293
}
286294
}
287295
} else {

0 commit comments

Comments
 (0)