Skip to content

Commit befc613

Browse files
committed
Add tests to document Option-handling behavior.
1 parent 5989593 commit befc613

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/CatalystTypeConvertersSuite.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,15 @@ class CatalystTypeConvertersSuite extends SparkFunSuite {
4848
assert(CatalystTypeConverters.createToScalaConverter(dataType)(null) === null)
4949
}
5050
}
51+
52+
test("option handling in convertToCatalyst") {
53+
// convertToCatalyst doesn't handle unboxing from Options. This is inconsistent with
54+
// createToCatalystConverter but it may not actually matter as this is only called internally
55+
// in a handful of places where we don't expect to receive Options.
56+
assert(CatalystTypeConverters.convertToCatalyst(Some(123)) === Some(123))
57+
}
58+
59+
test("option handling in createToCatalystConverter") {
60+
assert(CatalystTypeConverters.createToCatalystConverter(IntegerType)(Some(123)) === 123)
61+
}
5162
}

0 commit comments

Comments
 (0)