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_r358617660
 
 

 ##########
 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:
   Do you mean why in above test case query, `ArrayContains` is throwing 
`AnalysisException` instead of casting integer to Decimal?
   
   An integer cannot be casted to decimal with scale > 28.
   
   ```
   decimalWith28Zeroes = 1.0000000000000000000000000000
   SELECT array_contains(array(1), decimalWith28Zeroes);
   Result =>> true
   ```
   
   ```
   decimalWith29Zeroes = 1.00000000000000000000000000000
   SELECT array_contains(array(1), decimalWith29Zeroes);
   Result =>> AnalysisException
   ```

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