You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "panbingkun (via GitHub)" <gi...@apache.org> on 2023/07/04 01:08:11 UTC

[GitHub] [spark] panbingkun commented on a diff in pull request #41724: [SPARK-44210][CONNECT][SQL][PYTHON] Strengthen type checking and better comply with Connect specifications for `levenshtein` function

panbingkun commented on code in PR #41724:
URL: https://github.com/apache/spark/pull/41724#discussion_r1251372289


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala:
##########
@@ -2202,6 +2211,10 @@ case class Levenshtein(
     val thresholdEval = threshold.map(_.eval(input))
     thresholdEval match {
       case Some(v) =>
+        val vInt = v.asInstanceOf[Int]
+        if (vInt < 0) {
+          throw QueryExecutionErrors.invalidThresholdError(vInt)
+        }

Review Comment:
   Yes, 
   <img width="982" alt="b655f0bb7aff1a13776f5cddaf7e12cf" src="https://github.com/apache/spark/assets/15246973/6a9c521e-eeca-4927-bcef-3c1c740dddd0">
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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