spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiszk <...@git.apache.org>
Subject [GitHub] spark pull request #21028: [SPARK-23922][SQL] Add arrays_overlap function
Date Fri, 04 May 2018 15:56:24 GMT
Github user kiszk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21028#discussion_r186126547
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/DataFrameFunctionsSuite.scala ---
    @@ -413,6 +413,25 @@ class DataFrameFunctionsSuite extends QueryTest with SharedSQLContext
{
         )
       }
     
    +  test("arrays_overlap function") {
    +    val df = Seq(
    +      (Seq[Option[Int]](Some(1), Some(2)), Seq[Option[Int]](Some(-1), Some(10))),
    +      (Seq.empty[Option[Int]], Seq[Option[Int]](Some(-1), None)),
    +      (Seq[Option[Int]](Some(3), Some(2)), Seq[Option[Int]](Some(1), Some(2)))
    +    ).toDF("a", "b")
    +
    +    val answer = Seq(Row(false), Row(null), Row(true))
    +
    +    checkAnswer(df.select(arrays_overlap(df("a"), df("b"))), answer)
    +    checkAnswer(df.selectExpr("arrays_overlap(a, b)"), answer)
    +
    +    checkAnswer(sql("select arrays_overlap(array(1, 2, 3), array('a', 'b', 'c'))"), Row(false))
    +
    --- End diff --
    
    Do we add a test like this?
    ```
    val df = Seq((null, null)).toDF("a", "b")
    val ans = ...
    checkAnswer(df.select(array_overlap($"a", $"b")), ans)
    checkAnswer(df.selectExpr("array_overlap(a, b)"), ans)
    ```


---

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


Mime
View raw message