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

    https://github.com/apache/spark/pull/7580#discussion_r35281045
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/DataFrameFunctionsSuite.scala ---
    @@ -298,4 +298,28 @@ class DataFrameFunctionsSuite extends QueryTest {
           Seq(Row(2), Row(0), Row(3))
         )
       }
    +
    +  test("array contains function") {
    +    val df = Seq(
    +      (Seq[Int](1, 2), "x"),
    +      (Seq[Int](), "y"),
    +      (null, "z")
    +    ).toDF("a", "b")
    +    checkAnswer(
    +      df.select(array_contains("a", 1)),
    +      Seq(Row(true), Row(false), Row(false))
    +    )
    +    checkAnswer(
    +      df.selectExpr("array_contains(a, 1)"),
    +      Seq(Row(true), Row(false), Row(false))
    +    )
    +    // checkAnswer(
    +    //   df.select(array_contains("a", null)),
    --- End diff --
    
    I think that could cover it. We would still override `checkInputTypes` 
(which would override the one from ImplicitCastInputTypes` which itself comes 
from `ExpectsInputTypes`) and give it "loose" type bounds in `inputTypes`. By 
loose, I mean that I don't see a way to enforce the type dependency between the 
collection elements and the value with that alone, so it would have to be left 
to the `checkInputTypes` method. Then hopefully it will do implicit casts, but 
still insure that the types match or are castable to each other (by using 
`dataType.acceptsType`)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to