amanomer commented on a change in pull request #26811: [SPARK-29600][SQL] 
ArrayContains function may return incorrect result for DecimalType
URL: https://github.com/apache/spark/pull/26811#discussion_r358076174
 
 

 ##########
 File path: 
sql/core/src/test/scala/org/apache/spark/sql/DataFrameFunctionsSuite.scala
 ##########
 @@ -850,7 +850,7 @@ class DataFrameFunctionsSuite extends QueryTest with 
SharedSparkSession {
     val errorMsg1 =
       s"""
          |Input to function array_contains should have been array followed by a
-         |value with same element type, but it's [array<int>, decimal(29,29)].
+         |value with same element type, but it's [array<int>, decimal(38,29)].
 
 Review comment:
   
https://github.com/apache/spark/blob/1fc353d51a62cb554e6af23dbc9a613e214e3af1/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala#L864-L869
   For query `array_contains(array(1), .01234567890123456790123456780)`\
   `e.inputTypes` will return `Seq(Array(Decimal(38,29)), Decimal(38,29))` and 
above code will cast `.01234567890123456790123456780` as `Decimal(38,29)`. 
   Previously, when we were using `findWiderTypeForTwo`, decimal types were not 
getting upcasted but `findWiderTypeWithoutStringPromotionForTwo` will 
successfully upcast DecimalType 

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


With regards,
Apache Git Services

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

Reply via email to