Skip to content

Commit 3dc1f94

Browse files
committed
Minor changes to eliminate row object creation
1 parent 5b39cb9 commit 3dc1f94

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

sql/core/src/main/scala/org/apache/spark/sql/columnar/InMemoryColumnarTableScan.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,9 @@ private[sql] case class InMemoryRelation(
6161
ColumnBuilder(columnType.typeId, initialBufferSize, attribute.name, useCompression)
6262
}.toArray
6363

64-
var row: Row = null
6564
var rowCount = 0
66-
6765
while (rowIterator.hasNext && rowCount < batchSize) {
68-
row = rowIterator.next()
66+
val row = rowIterator.next()
6967
var i = 0
7068
while (i < row.length) {
7169
columnBuilders(i).appendFrom(row, i)
@@ -212,6 +210,7 @@ private[sql] case class InMemoryColumnarTableScan(
212210
}.unzip
213211
}
214212

213+
val nextRow = new SpecificMutableRow(requestedColumnDataTypes)
215214
val rows = iterator
216215
// Skip pruned batches
217216
.filter { cachedBatch =>
@@ -233,7 +232,6 @@ private[sql] case class InMemoryColumnarTableScan(
233232
}
234233
// Extract rows via column accessors
235234
.flatMap { columnAccessors =>
236-
val nextRow = new SpecificMutableRow(requestedColumnDataTypes)
237235
new Iterator[Row] {
238236
override def next() = {
239237
var i = 0

0 commit comments

Comments
 (0)