Github user ueshin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21028#discussion_r187236142
  
    --- Diff: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CollectionExpressionsSuite.scala
 ---
    @@ -136,6 +136,59 @@ class CollectionExpressionsSuite extends SparkFunSuite 
with ExpressionEvalHelper
         checkEvaluation(ArrayContains(a3, Literal.create(null, StringType)), 
null)
       }
     
    +  test("ArraysOverlap") {
    +    val a0 = Literal.create(Seq(1, 2, 3), ArrayType(IntegerType))
    +    val a1 = Literal.create(Seq(4, 5, 3), ArrayType(IntegerType))
    +    val a2 = Literal.create(Seq(null, 5, 6), ArrayType(IntegerType))
    +    val a3 = Literal.create(Seq(7, 8), ArrayType(IntegerType))
    +    val a4 = Literal.create(Seq.empty[Int], ArrayType(IntegerType))
    +
    +    val a5 = Literal.create(Seq[String](null, ""), ArrayType(StringType))
    +    val a6 = Literal.create(Seq[String]("", "abc"), ArrayType(StringType))
    +    val a7 = Literal.create(Seq[String]("def", "ghi"), 
ArrayType(StringType))
    +
    +    checkEvaluation(ArraysOverlap(a0, a1), true)
    +    checkEvaluation(ArraysOverlap(a0, a2), null)
    +    checkEvaluation(ArraysOverlap(a1, a2), true)
    +    checkEvaluation(ArraysOverlap(a1, a3), false)
    +    checkEvaluation(ArraysOverlap(a0, a4), false)
    +    checkEvaluation(ArraysOverlap(a2, a4), null)
    +    checkEvaluation(ArraysOverlap(a4, a2), null)
    +
    +    checkEvaluation(ArraysOverlap(a5, a6), true)
    +    checkEvaluation(ArraysOverlap(a5, a7), null)
    +    checkEvaluation(ArraysOverlap(a6, a7), false)
    +
    +    // null handling
    +    checkEvaluation(ArraysOverlap(Literal.create(null, 
ArrayType(IntegerType)), a0), null)
    +    checkEvaluation(ArraysOverlap(a0, Literal.create(null, 
ArrayType(IntegerType))), null)
    +    checkEvaluation(ArraysOverlap(
    +      Literal.create(Seq(null), ArrayType(IntegerType)),
    +      Literal.create(Seq(null), ArrayType(IntegerType))), null)
    --- End diff --
    
    What if `arrays_overlap(array(), array(null))`?
    Seems like Presto returns `false` for the case. 
[TestArrayOperators.java#L1041](https://github.com/prestodb/presto/blob/master/presto-main/src/test/java/com/facebook/presto/type/TestArrayOperators.java#L1041)
    Also can you add the test case?


---

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

Reply via email to