You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Yang Jie (Jira)" <ji...@apache.org> on 2022/10/13 12:03:00 UTC

[jira] [Commented] (SPARK-40732) Double type precision problem

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

Yang Jie commented on SPARK-40732:
----------------------------------

{code:java}
bin/jshell
|  欢迎使用 JShell -- 版本 19
|  要大致了解该版本, 请键入: /help intro


jshell> ((double)9223372036854775807L)/((double)2.0)
$1 ==> 4.611686018427388E18 {code}
{code:java}
zulu17 % bin/jshell 
|  欢迎使用 JShell -- 版本 17.0.4.1
|  要大致了解该版本, 请键入: /help intro


jshell> ((double)9223372036854775807L)/((double)2.0)
$1 ==> 4.6116860184273879E18 {code}
{code:java}
bin/jshell 
|  欢迎使用 JShell -- 版本 18.0.2.1
|  要大致了解该版本, 请键入: /help intro


jshell>  ((double)9223372036854775807L)/((double)2.0)
$1 ==> 4.6116860184273879E18 {code}
The result of `((double)9223372036854775807L)/((double)2.0)`  running with Java 19 is different from that of other versions

 

cc [~rednaxelafx] Do you know why?

> Double type precision problem
> -----------------------------
>
>                 Key: SPARK-40732
>                 URL: https://issues.apache.org/jira/browse/SPARK-40732
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 3.4.0
>            Reporter: Yang Jie
>            Priority: Major
>
> Some case in SQLQueryTestSuite(sql/core) and ThriftServerQueryTestSuite(sql/hive-thriftserver) failed for this reason:
> for example:
>  
> {code:java}
> SQLQueryTestSuite- 
> try_aggregates.sql *** FAILED ***
>   try_aggregates.sql
>   Expected "4.61168601842738[79]E18", but got "4.61168601842738[8]E18" Result did not match for query #20
>   SELECT try_avg(col) FROM VALUES (9223372036854775807L), (1L) AS tab(col) (SQLQueryTestSuite.scala:495) 
> {code}
> {code:java}
> ThriftServerQueryTestSuite- try_aggregates.sql *** FAILED ***
>   Expected "4.61168601842738[79]E18", but got "4.61168601842738[8]E18" Result did not match for query #20
>   SELECT try_avg(col) FROM VALUES (9223372036854775807L), (1L) AS tab(col) (ThriftServerQueryTestSuite.scala:222)- try_arithmetic.sql *** FAILED ***
>   Expected "-4.65661287307739[26]E-10", but got "-4.65661287307739[3]E-10" Result did not match for query #26
>   SELECT try_divide(1, (2147483647 + 1)) (ThriftServerQueryTestSuite.scala:222)- datetime-formatting.sql *** FAILED ***
>   Expected "...-05-31 19:40:35.123  [3
>   1969-12-31 15:00:00 3
>   1970-12-31 04:59:59.999 3
>   1996-03-31 07:03:33.123 3
>   2018-11-17 05:33:33.123 3
>   2019-12-31 09:33:33.123 3]
>   2100-01-01 01:33:33...", but got "...-05-31 19:40:35.123  [5
>   1969-12-31 15:00:00 5
>   1970-12-31 04:59:59.999 5
>   1996-03-31 07:03:33.123 5
>   2018-11-17 05:33:33.123 3
>   2019-12-31 09:33:33.123 5]
>   2100-01-01 01:33:33..." Result did not match for query #8
>   select col, date_format(col, 'F') from v (ThriftServerQueryTestSuite.scala:222) {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org