[
https://issues.apache.org/jira/browse/SPARK-33958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17258109#comment-17258109
]
Zhang Jianguo edited comment on SPARK-33958 at 1/4/21, 9:50 AM:
----------------------------------------------------------------
[~yumwang]
Gauss and Oracle return 0. And it looks match SQL standard better.
My solution as following, plus 0.0 at every return of FloatType and DoubleType.
0.0 + 0.0 = 0.0
-0.0 + 0.0 = 0.0
I can provide pull request later.
was (Author: alberyzjg):
[~yumwang]
Gauss and Oracle return 0. And it looks mathe troditional SQL standard better.
My solution as following, plus 0.0 at every return of FloatType and DoubleType.
0.0 + 0.0 = 0.0
-0.0 + 0.0 = 0.0
I can provide pull request later.
> spark sql DoubleType(0 * (-1)) return "-0.0"
> ---------------------------------------------
>
> Key: SPARK-33958
> URL: https://issues.apache.org/jira/browse/SPARK-33958
> Project: Spark
> Issue Type: Bug
> Components: Spark Core
> Affects Versions: 2.3.2, 2.4.5, 3.0.0
> Reporter: Zhang Jianguo
> Priority: Minor
>
> spark version: 2.3.2
> {code:java}
> create table test_zjg(a double);
> insert into test_zjg values(-1.0);
> select a*0 from test_zjg
> {code}
> After select operation, *{color:#de350b}we will get -0.0 which expected as
> 0.0:{color}*
> \+------------------------\+
> \|(a * CAST(0 AS DOUBLE))\|
> \+------------------------\+
> \|-0.0 \|
> \+------------------------\+
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]