File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
sql/core/src/main/scala/org/apache/spark/sql/parquet Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -126,9 +126,13 @@ private[sql] case class ParquetTableScan(
126
126
conf)
127
127
128
128
if (requestedPartitionOrdinals.nonEmpty) {
129
- // This check if based on CatalystConverter.createRootConverter.
129
+ // This check is based on CatalystConverter.createRootConverter.
130
130
val primitiveRow = output.forall(a => ParquetTypesConverter .isPrimitiveType(a.dataType))
131
131
132
+ // Uses temporary variable to avoid the whole `ParquetTableScan` object being captured into
133
+ // the `mapPartitionsWithInputSplit` closure below.
134
+ val outputSize = output.size
135
+
132
136
baseRDD.mapPartitionsWithInputSplit { case (split, iter) =>
133
137
val partValue = " ([^=]+)=([^=]+)" .r
134
138
val partValues =
@@ -165,7 +169,7 @@ private[sql] case class ParquetTableScan(
165
169
}
166
170
} else {
167
171
// Create a mutable row since we need to fill in values from partition columns.
168
- val mutableRow = new GenericMutableRow (output.size )
172
+ val mutableRow = new GenericMutableRow (outputSize )
169
173
new Iterator [Row ] {
170
174
def hasNext = iter.hasNext
171
175
def next () = {
Original file line number Diff line number Diff line change @@ -476,7 +476,7 @@ private[sql] case class ParquetRelation2(
476
476
// When the data does not include the key and the key is requested then we must fill it in
477
477
// based on information from the input split.
478
478
if (! partitionKeysIncludedInDataSchema && partitionKeyLocations.nonEmpty) {
479
- // This check if based on CatalystConverter.createRootConverter.
479
+ // This check is based on CatalystConverter.createRootConverter.
480
480
val primitiveRow =
481
481
requestedSchema.forall(a => ParquetTypesConverter .isPrimitiveType(a.dataType))
482
482
You can’t perform that action at this time.
0 commit comments