Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-32458][SQL][TESTS] Fix incorrectly sized row value reads. #29258

Closed
wants to merge 1 commit into from
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 @@ -336,7 +336,7 @@ class RowEncoderSuite extends CodegenInterpretedPlanTest {
val encoder = RowEncoder(schema).resolveAndBind()
val localDate = java.time.LocalDate.parse("2019-02-27")
val row = toRow(encoder, Row(localDate))
assert(row.getLong(0) === DateTimeUtils.localDateToDays(localDate))
assert(row.getInt(0) === DateTimeUtils.localDateToDays(localDate))
val readback = fromRow(encoder, row)
assert(readback.get(0).equals(localDate))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ class UnsafeMapSuite extends SparkFunSuite {
val ser = new JavaSerializer(new SparkConf).newInstance()
val mapDataSer = ser.deserialize[UnsafeMapData](ser.serialize(unsafeMapData))
assert(mapDataSer.numElements() == 1)
assert(mapDataSer.keyArray().getInt(0) == 19285)
assert(mapDataSer.valueArray().getInt(0) == 19286)
assert(mapDataSer.keyArray().getLong(0) == 19285)
assert(mapDataSer.valueArray().getLong(0) == 19286)
assert(mapDataSer.getBaseObject.asInstanceOf[Array[Byte]].length == 1024)
}

test("unsafe Kryo serialization") {
val ser = new KryoSerializer(new SparkConf).newInstance()
val mapDataSer = ser.deserialize[UnsafeMapData](ser.serialize(unsafeMapData))
assert(mapDataSer.numElements() == 1)
assert(mapDataSer.keyArray().getInt(0) == 19285)
assert(mapDataSer.valueArray().getInt(0) == 19286)
assert(mapDataSer.keyArray().getLong(0) == 19285)
assert(mapDataSer.valueArray().getLong(0) == 19286)
assert(mapDataSer.getBaseObject.asInstanceOf[Array[Byte]].length == 1024)
}
}