You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "jackylee-ch (via GitHub)" <gi...@apache.org> on 2025/04/29 13:05:22 UTC

[PR] [SPARK-51941][SQL][3.5] Fix the precision problem for convertToCatalyst when the Input is BigDecimal between -1.0 and 1.0 [spark]

jackylee-ch opened a new pull request, #50754:
URL: https://github.com/apache/spark/pull/50754

   ### What changes were proposed in this pull request?
   In [SPARK-20211](https://issues.apache.org/jira/browse/SPARK-20211), we addressed a fix with BigDecimal type conversion exceptions. However, the CatalystTypeConverters.convertToCatalyst method was not updated accordingly, causing users to still encounter exceptions when attempting to convert BigDecimal types. Below is a reproducible example case for this problem.
   ```
   CatalystTypeConverters.convertToCatalyst(BigDecimal("0.01")) 
   ```
   ```
   Decimal scale (2) cannot be greater than precision (1).
   org.apache.spark.sql.AnalysisException: Decimal scale (2) cannot be greater than precision (1).
       at org.apache.spark.sql.errors.DataTypeErrors$.decimalCannotGreaterThanPrecisionError(DataTypeErrors.scala:122)
       at org.apache.spark.sql.types.DecimalType.<init>(DecimalType.scala:46)
       at org.apache.spark.sql.catalyst.CatalystTypeConverters$.convertToCatalyst(CatalystTypeConverters.scala:578)
       at org.apache.spark.sql.catalyst.CatalystTypeConvertersSuite.$anonfun$new$18(CatalystTypeConvertersSuite.scala:159) 
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   No.
   
   ### How was this patch tested?
   Newly added test.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No.
   


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


Re: [PR] [SPARK-51941][SQL][3.5] Fix the precision problem for convertToCatalyst when the Input is BigDecimal between -1.0 and 1.0 [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang closed pull request #50754: [SPARK-51941][SQL][3.5] Fix the precision problem for convertToCatalyst when the Input is BigDecimal between -1.0 and 1.0
URL: https://github.com/apache/spark/pull/50754


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


Re: [PR] [SPARK-51941][SQL][3.5] Fix the precision problem for convertToCatalyst when the Input is BigDecimal between -1.0 and 1.0 [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on PR #50754:
URL: https://github.com/apache/spark/pull/50754#issuecomment-2839397417

   Merged into branch-3.5 due to this is a bug fix. Thank you @jackylee-ch 


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


Re: [PR] [SPARK-51941][SQL][3.5] Fix the precision problem for convertToCatalyst when the Input is BigDecimal between -1.0 and 1.0 [spark]

Posted by "jackylee-ch (via GitHub)" <gi...@apache.org>.
jackylee-ch commented on PR #50754:
URL: https://github.com/apache/spark/pull/50754#issuecomment-2839381644

   This is a backport PR for 3.5. @LuciferYang PTAL


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