Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ final class SpecificMutableRow(val values: Array[MutableValue]) extends MutableR
new SpecificMutableRow(newValues)
}

override def update(ordinal: Int, value: Any): Unit = values(ordinal).update(value)
override def update(ordinal: Int, value: Any): Unit = {
if (value == null) setNullAt(ordinal) else values(ordinal).update(value)
}

override def iterator: Iterator[Any] = values.map(_.boxed).iterator

Expand Down
8 changes: 7 additions & 1 deletion sql/core/src/test/scala/org/apache/spark/sql/RowSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package org.apache.spark.sql

import org.scalatest.FunSuite

import org.apache.spark.sql.catalyst.expressions.GenericMutableRow
import org.apache.spark.sql.catalyst.expressions.{GenericMutableRow, SpecificMutableRow}

class RowSuite extends FunSuite {

Expand All @@ -43,4 +43,10 @@ class RowSuite extends FunSuite {
assert(expected.getBoolean(2) === actual2.getBoolean(2))
assert(expected(3) === actual2(3))
}

test("SpecificMutableRow.update with null") {
val row = new SpecificMutableRow(Seq(IntegerType))
row(0) = null
assert(row.isNullAt(0))
}
}