Skip to content

Commit

Permalink
Add tests to document Option-handling behavior.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshRosen committed Jun 1, 2015
1 parent 5989593 commit befc613
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,15 @@ class CatalystTypeConvertersSuite extends SparkFunSuite {
assert(CatalystTypeConverters.createToScalaConverter(dataType)(null) === null)
}
}

test("option handling in convertToCatalyst") {
// convertToCatalyst doesn't handle unboxing from Options. This is inconsistent with
// createToCatalystConverter but it may not actually matter as this is only called internally
// in a handful of places where we don't expect to receive Options.
assert(CatalystTypeConverters.convertToCatalyst(Some(123)) === Some(123))
}

test("option handling in createToCatalystConverter") {
assert(CatalystTypeConverters.createToCatalystConverter(IntegerType)(Some(123)) === 123)
}
}

0 comments on commit befc613

Please sign in to comment.