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

    https://github.com/apache/spark/pull/21050#discussion_r189376200
  
    --- Diff: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CollectionExpressionsSuite.scala
 ---
    @@ -552,4 +552,26 @@ class CollectionExpressionsSuite extends SparkFunSuite 
with ExpressionEvalHelper
         checkEvaluation(ArrayRepeat(strArray, Literal(2)), Seq(Seq("hi", 
"hola"), Seq("hi", "hola")))
         checkEvaluation(ArrayRepeat(Literal("hi"), Literal(null, 
IntegerType)), null)
       }
    +
    +  test("Array Distinct") {
    +    val a0 = Literal.create(Seq(2, 1, 2, 3, 4, 4, 5), 
ArrayType(IntegerType))
    +    val a1 = Literal.create(Seq.empty[Integer], ArrayType(IntegerType))
    +    val a2 = Literal.create(Seq("b", "a", "a", "c", "b"), 
ArrayType(StringType))
    +    val a3 = Literal.create(Seq("b", null, "a", null, "a", null), 
ArrayType(StringType))
    +    val a4 = Literal.create(Seq(null, null, null), ArrayType(NullType))
    +    val a5 = Literal.create(Seq(true, false, false, true), 
ArrayType(BooleanType))
    +    val a6 = Literal.create(Seq(1.123, 0.1234, 1.121, 1.123, 1.1230, 
1.121, 0.1234),
    +      ArrayType(DoubleType))
    +    val a7 = Literal.create(Seq(1.123f, 0.1234f, 1.121f, 1.123f, 1.1230f, 
1.121f, 0.1234f),
    +      ArrayType(FloatType))
    +
    +    checkEvaluation(new ArrayDistinct(a0), Seq(2, 1, 3, 4, 5))
    +    checkEvaluation(new ArrayDistinct(a1), Seq.empty[Integer])
    +    checkEvaluation(new ArrayDistinct(a2), Seq("b", "a", "c"))
    +    checkEvaluation(new ArrayDistinct(a3), Seq("b", null, "a"))
    +    checkEvaluation(new ArrayDistinct(a4), Seq(null))
    +    checkEvaluation(new ArrayDistinct(a5), Seq(true, false))
    +    checkEvaluation(new ArrayDistinct(a6), Seq(1.123, 0.1234, 1.121))
    +    checkEvaluation(new ArrayDistinct(a7), Seq(1.123f, 0.1234f, 1.121f))
    --- End diff --
    
    Could you please add test cases with complex types (e.g. `Array[Binary]`)? 
See #21361.


---

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

Reply via email to