This is an automated email from the ASF dual-hosted git repository.

maxgekk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 295f540a92f [SPARK-43786][SQL][TESTS] Add a test for nullability about 
'levenshtein' function
295f540a92f is described below

commit 295f540a92f9a4bde1da1244901b844223777a78
Author: panbingkun <pbk1...@gmail.com>
AuthorDate: Thu May 25 15:34:25 2023 +0300

    [SPARK-43786][SQL][TESTS] Add a test for nullability about 'levenshtein' 
function
    
    ### What changes were proposed in this pull request?
    The pr aims to add a test for nullability about 'levenshtein' function.
    
    ### Why are the changes needed?
    Make testing more robust about 'levenshtein' function.
    
    ### Does this PR introduce _any_ user-facing change?
    No.
    
    ### How was this patch tested?
    - Pass GA.
    - Manual testing
    
    Closes #41303 from panbingkun/SPARK-43786.
    
    Authored-by: panbingkun <pbk1...@gmail.com>
    Signed-off-by: Max Gekk <max.g...@gmail.com>
---
 .../src/test/scala/org/apache/spark/sql/StringFunctionsSuite.scala  | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/StringFunctionsSuite.scala 
b/sql/core/src/test/scala/org/apache/spark/sql/StringFunctionsSuite.scala
index e887c570944..f612c5903dc 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/StringFunctionsSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/StringFunctionsSuite.scala
@@ -129,12 +129,18 @@ class StringFunctionsSuite extends QueryTest with 
SharedSparkSession {
     val df = Seq(("kitten", "sitting"), ("frog", "fog")).toDF("l", "r")
     checkAnswer(df.select(levenshtein($"l", $"r")), Seq(Row(3), Row(1)))
     checkAnswer(df.selectExpr("levenshtein(l, r)"), Seq(Row(3), Row(1)))
+    checkAnswer(df.select(levenshtein($"l", lit(null))), Seq(Row(null), 
Row(null)))
+    checkAnswer(df.selectExpr("levenshtein(l, null)"), Seq(Row(null), 
Row(null)))
 
     checkAnswer(df.select(levenshtein($"l", $"r", 3)), Seq(Row(3), Row(1)))
     checkAnswer(df.selectExpr("levenshtein(l, r, 3)"), Seq(Row(3), Row(1)))
+    checkAnswer(df.select(levenshtein(lit(null), $"r", 3)), Seq(Row(null), 
Row(null)))
+    checkAnswer(df.selectExpr("levenshtein(null, r, 3)"), Seq(Row(null), 
Row(null)))
 
     checkAnswer(df.select(levenshtein($"l", $"r", 0)), Seq(Row(-1), Row(-1)))
     checkAnswer(df.selectExpr("levenshtein(l, r, 0)"), Seq(Row(-1), Row(-1)))
+    checkAnswer(df.select(levenshtein($"l", lit(null), 0)), Seq(Row(null), 
Row(null)))
+    checkAnswer(df.selectExpr("levenshtein(l, null, 0)"), Seq(Row(null), 
Row(null)))
   }
 
   test("string regex_replace / regex_extract") {


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

Reply via email to