HyukjinKwon commented on a change in pull request #32684:
URL: https://github.com/apache/spark/pull/32684#discussion_r640309671
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/MathFunctionsSuite.scala
##########
@@ -203,6 +203,21 @@ class MathFunctionsSuite extends QueryTest with
SharedSparkSession {
df.selectExpr("""conv("9223372036854775807", 36, -16)"""), Row("-1")) //
for overflow
}
+ test("SPARK-33428 conv function should trim input string") {
+ val df = Seq(("abc"), (" abc"), ("abc "), (" abc ")).toDF("num")
+ checkAnswer(df.select(conv('num, 16, 10)),
+ Seq(Row("2748"), Row("2748"), Row("2748"), Row("2748")))
+ checkAnswer(df.select(conv('num, 16, -10)),
+ Seq(Row("2748"), Row("2748"), Row("2748"), Row("2748")))
+ }
+
+ test("SPARK-33428 conv function shouldn't raise error input string is too
big") {
Review comment:
```suggestion
test("SPARK-33428 conv function shouldn't raise error input string is too
big") {
```
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/NumberConverter.scala
##########
@@ -135,6 +138,7 @@ object NumberConverter {
}
decode(v, Math.abs(toBase), temp)
+
Review comment:
```suggestion
```
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]