Github user chenghao-intel commented on a diff in the pull request:
https://github.com/apache/spark/pull/7580#discussion_r35280823
--- 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 --
Hmm, that's a good question, I am wondering if we need to add the implicit
casting for the second argument of the `ArrayContains`, that mean we need to
inherit from the `ImplicitCastInputTypes`. and keep the first input data
type(expected data type) unchanged, but the second input data type depends on
the first one.
---
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]