You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2024/03/31 22:37:12 UTC

(spark) branch branch-3.4 updated: [SPARK-47646][SQL][FOLLOWUP][3.4] Replace non-existing try_to_number function with TryToNumber

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

dongjoon pushed a commit to branch branch-3.4
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.4 by this push:
     new a1544152248d [SPARK-47646][SQL][FOLLOWUP][3.4] Replace non-existing try_to_number function with TryToNumber
a1544152248d is described below

commit a1544152248d6868ebef51932379e9eda8985e60
Author: Liang-Chi Hsieh <vi...@gmail.com>
AuthorDate: Sun Mar 31 15:37:01 2024 -0700

    [SPARK-47646][SQL][FOLLOWUP][3.4] Replace non-existing try_to_number function with TryToNumber
    
    ### What changes were proposed in this pull request?
    
    This patch fixes broken CI by replacing non-existing `try_to_number` function in branch-3.4.
    
    ### Why are the changes needed?
    
    #45771 backported a test to `StringFunctionsSuite` in branch-3.4 but it uses `try_to_number` which is added since Spark 3.5.
    So this patch fixes the broken CI: https://github.com/apache/spark/actions/runs/8494692184/job/23270175100
    
    ### Does this PR introduce _any_ user-facing change?
    
    No
    
    ### How was this patch tested?
    
    Unit test
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No
    
    Closes #45785 from viirya/fix.
    
    Authored-by: Liang-Chi Hsieh <vi...@gmail.com>
    Signed-off-by: Dongjoon Hyun <dh...@apple.com>
---
 .../src/test/scala/org/apache/spark/sql/StringFunctionsSuite.scala    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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 404a1e742d19..18123a4d6ec6 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
@@ -19,6 +19,7 @@ package org.apache.spark.sql
 
 import org.apache.spark.{SPARK_DOC_ROOT, SparkRuntimeException}
 import org.apache.spark.sql.catalyst.expressions.Cast._
+import org.apache.spark.sql.catalyst.expressions.TryToNumber
 import org.apache.spark.sql.functions._
 import org.apache.spark.sql.internal.SQLConf
 import org.apache.spark.sql.test.SharedSparkSession
@@ -717,6 +718,7 @@ class StringFunctionsSuite extends QueryTest with SharedSparkSession {
 
   test("SPARK-47646: try_to_number should return NULL for malformed input") {
     val df = spark.createDataset(spark.sparkContext.parallelize(Seq("11")))
-    checkAnswer(df.select(try_to_number($"value", lit("$99.99"))), Seq(Row(null)))
+    val try_to_number = Column(TryToNumber($"value".expr, lit("$99.99").expr))
+    checkAnswer(df.select(try_to_number), Seq(Row(null)))
   }
 }


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