Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/22749#discussion_r227742062
  
    --- 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 --
    
    shall we create a `deserializerFor` method in this test suite to save some 
code diff?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to