[ 
https://issues.apache.org/jira/browse/SPARK-22755?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16286471#comment-16286471
 ] 

Sunitha Kambhampati commented on SPARK-22755:
---------------------------------------------

I just tried this in sql on the trunk codeline, and both those statements 
return true: 
{code}
  test("SPARK-22755") {
    spark.sql("select ((946-885)*1.0/946 < 0.1)").show
    spark.sql("select ((946-885)*1.0/946 < 0.100)").show
  }

+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|(CAST((CAST((CAST(CAST((946 - 885) AS DECIMAL(10,0)) AS DECIMAL(11,1)) * 
CAST(1.0 AS DECIMAL(11,1))) AS DECIMAL(13,1)) / CAST(CAST(946 AS DECIMAL(10,0)) 
AS DECIMAL(13,1))) AS DECIMAL(24,12)) < CAST(0.1 AS DECIMAL(24,12)))|
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                                               
                                                                                
                                                          true|
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|(CAST((CAST((CAST(CAST((946 - 885) AS DECIMAL(10,0)) AS DECIMAL(11,1)) * 
CAST(1.0 AS DECIMAL(11,1))) AS DECIMAL(13,1)) / CAST(CAST(946 AS DECIMAL(10,0)) 
AS DECIMAL(13,1))) AS DECIMAL(24,12)) < CAST(0.100 AS DECIMAL(24,12)))|
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                                               
                                                                                
                                                            true|
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

{code}

> Expression (946-885)*1.0/946 < 0.1 and (946-885)*1.000/946 < 0.1 return 
> different results
> -----------------------------------------------------------------------------------------
>
>                 Key: SPARK-22755
>                 URL: https://issues.apache.org/jira/browse/SPARK-22755
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.2.0
>            Reporter: Kevin Zhang
>
> both of the following sql statements
> {code:sql}
> select ((946-885)*1.000/946 < 0.1)
> {code}
> and
> {code:sql}
> select ((946-885)*1.0/946 < 0.100)
> {code}
> return true, while the following statement 
> {code:sql}
> select ((946-885)*1.0/946 < 0.1)
> {code}
> returns false



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to