Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/22749#discussion_r227745900
--- Diff:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/ScalaReflectionSuite.scala
---
@@ -351,11 +347,15 @@ class ScalaReflectionSuite extends SparkFunSuite {
test("SPARK-23835: add null check to non-nullable types in Tuples") {
def numberOfCheckedArguments(deserializer: Expression): Int = {
- assert(deserializer.isInstanceOf[NewInstance])
-
deserializer.asInstanceOf[NewInstance].arguments.count(_.isInstanceOf[AssertNotNull])
+ val newInstance = deserializer.collect { case n: NewInstance =>
n}.head
+ newInstance.arguments.count(_.isInstanceOf[AssertNotNull])
}
- assert(numberOfCheckedArguments(deserializerFor[(Double, Double)]) ==
2)
- assert(numberOfCheckedArguments(deserializerFor[(java.lang.Double,
Int)]) == 1)
- assert(numberOfCheckedArguments(deserializerFor[(java.lang.Integer,
java.lang.Integer)]) == 0)
+ assert(numberOfCheckedArguments(
+ deserializerForType(ScalaReflection.localTypeOf[(Double, Double)]))
== 2)
--- End diff --
Sounds good.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]