This is an automated email from the ASF dual-hosted git repository.
gurwls223 pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new 664443c [MINOR][SQL] Add `IS [NOT] NULL` examples to
ArrayFilter/ArrayExists
664443c is described below
commit 664443c29c71bd6424132cb1ec636df420833ed9
Author: Dilip Biswal <[email protected]>
AuthorDate: Mon Jun 22 21:38:19 2020 +0900
[MINOR][SQL] Add `IS [NOT] NULL` examples to ArrayFilter/ArrayExists
### What changes were proposed in this pull request?
A minor PR that adds a couple of usage examples for ArrayFilter and
ArrayExists that shows how to deal with NULL data.
### Why are the changes needed?
Enhances the examples that shows how to filter out null values from an
array and also to test if null value exists in an array.
### Does this PR introduce any user-facing change?
No.
### How was this patch tested?
Tested manually.
Closes #28890 from dilipbiswal/array_func_description.
Authored-by: Dilip Biswal <[email protected]>
Signed-off-by: HyukjinKwon <[email protected]>
(cherry picked from commit 6293c38cff66c503370e970b7e8e0af9f993a3c2)
Signed-off-by: HyukjinKwon <[email protected]>
---
.../spark/sql/catalyst/expressions/higherOrderFunctions.scala | 6 ++++++
1 file changed, 6 insertions(+)
diff --git
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/higherOrderFunctions.scala
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/higherOrderFunctions.scala
index e91bd0c..e5cf8c0 100644
---
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/higherOrderFunctions.scala
+++
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/higherOrderFunctions.scala
@@ -454,6 +454,8 @@ case class MapFilter(
[1,3]
> SELECT _FUNC_(array(0, 2, 3), (x, i) -> x > i);
[2,3]
+ > SELECT _FUNC_(array(0, null, 2, 3, null), x -> x IS NOT NULL);
+ [0,2,3]
""",
since = "2.4.0",
note = """
@@ -518,6 +520,10 @@ case class ArrayFilter(
false
> SELECT _FUNC_(array(1, null, 3), x -> x % 2 == 0);
NULL
+ > SELECT _FUNC_(array(0, null, 2, 3, null), x -> x IS NULL);
+ true
+ > SELECT _FUNC_(array(1, 2, 3), x -> x IS NULL);
+ false
""",
since = "2.4.0")
case class ArrayExists(
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]