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

dongjoon 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 c0c017af8b49 [SPARK-52573][PYTHON][TESTS] Add tests for decimal type
c0c017af8b49 is described below

commit c0c017af8b49c4519a08f17b53958123936dccc3
Author: Ruifeng Zheng <[email protected]>
AuthorDate: Wed Jun 25 10:31:16 2025 -0700

    [SPARK-52573][PYTHON][TESTS] Add tests for decimal type
    
    ### What changes were proposed in this pull request?
    Add tests for decimal type
    
    ### Why are the changes needed?
    for test coverage
    
    ### Does this PR introduce _any_ user-facing change?
    no, test-only
    
    ### How was this patch tested?
    ci
    
    ### Was this patch authored or co-authored using generative AI tooling?
    no
    
    Closes #51278 from zhengruifeng/py_arrow_decimal.
    
    Authored-by: Ruifeng Zheng <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 python/pyspark/sql/tests/arrow/test_arrow_udf_scalar.py | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/python/pyspark/sql/tests/arrow/test_arrow_udf_scalar.py 
b/python/pyspark/sql/tests/arrow/test_arrow_udf_scalar.py
index 052956db6e6e..d111e3f407a9 100644
--- a/python/pyspark/sql/tests/arrow/test_arrow_udf_scalar.py
+++ b/python/pyspark/sql/tests/arrow/test_arrow_udf_scalar.py
@@ -536,7 +536,9 @@ class ScalarArrowUDFTestsMixin:
             F.col("id").alias("long"),
             F.col("id").cast("float").alias("float"),
             F.col("id").cast("double").alias("double"),
-            # F.col("id").cast("decimal").alias("decimal"),
+            F.col("id").cast("decimal").alias("decimal1"),
+            F.col("id").cast("decimal(10, 0)").alias("decimal2"),
+            F.col("id").cast("decimal(38, 18)").alias("decimal3"),
             F.col("id").cast("boolean").alias("bool"),
         )
 
@@ -549,7 +551,9 @@ class ScalarArrowUDFTestsMixin:
             long_f = arrow_udf(f, "long", udf_type)
             float_f = arrow_udf(f, "float", udf_type)
             double_f = arrow_udf(f, "double", udf_type)
-            # decimal_f = arrow_udf(f, "decimal(38, 18)", udf_type)
+            decimal1_f = arrow_udf(f, "decimal", udf_type)
+            decimal2_f = arrow_udf(f, "decimal(10, 0)", udf_type)
+            decimal3_f = arrow_udf(f, "decimal(38, 18)", udf_type)
             bool_f = arrow_udf(f, "boolean", udf_type)
             res = df.select(
                 str_f(F.col("str")),
@@ -557,7 +561,9 @@ class ScalarArrowUDFTestsMixin:
                 long_f(F.col("long")),
                 float_f(F.col("float")),
                 double_f(F.col("double")),
-                # decimal_f("decimal"),
+                decimal1_f("decimal1"),
+                decimal2_f("decimal2"),
+                decimal3_f("decimal3"),
                 bool_f(F.col("bool")),
             )
             self.assertEqual(df.collect(), res.collect())


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to