You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "NarekDW (via GitHub)" <gi...@apache.org> on 2023/02/15 16:32:43 UTC

[GitHub] [spark] NarekDW commented on a diff in pull request #40040: [WIP][SPARK-42399] [SQL] Support big numbers for conv function (get rid of overflow)

NarekDW commented on code in PR #40040:
URL: https://github.com/apache/spark/pull/40040#discussion_r1107365294


##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/MathExpressionsSuite.scala:
##########
@@ -158,45 +158,42 @@ class MathExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
   }
 
   test("conv") {
-    Seq(true, false).foreach { ansiEnabled =>
-      checkEvaluation(Conv(Literal("3"), Literal(10), Literal(2), ansiEnabled), "11")
-      checkEvaluation(Conv(Literal("-15"), Literal(10), Literal(-16), ansiEnabled), "-F")
-      checkEvaluation(
-        Conv(Literal("-15"), Literal(10), Literal(16), ansiEnabled), "FFFFFFFFFFFFFFF1")
-      checkEvaluation(Conv(Literal("big"), Literal(36), Literal(16), ansiEnabled), "3A48")
-      checkEvaluation(Conv(Literal.create(null, StringType), Literal(36), Literal(16), ansiEnabled),
-        null)
-      checkEvaluation(
-        Conv(Literal("3"), Literal.create(null, IntegerType), Literal(16), ansiEnabled), null)
-      checkEvaluation(
-        Conv(Literal("3"), Literal(16), Literal.create(null, IntegerType), ansiEnabled), null)
-      checkEvaluation(
-        Conv(Literal("1234"), Literal(10), Literal(37), ansiEnabled), null)
-      checkEvaluation(
-        Conv(Literal(""), Literal(10), Literal(16), ansiEnabled), null)
-
-      // If there is an invalid digit in the number, the longest valid prefix should be converted.
-      checkEvaluation(
-        Conv(Literal("11abc"), Literal(10), Literal(16), ansiEnabled), "B")

Review Comment:
   This behaviour is strange a bit, if it is required I'll add this functionality as well.



-- 
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