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

Takeshi Yamamuro commented on SPARK-24401:
------------------------------------------

I didn't narrow down  and I'm not sure that this is related to this issue 
though, I found v2.2.0 had an incorrect result (fixed in v2.2.1);
As marco said, I'd be greated if you try on master;
{code}
// v2.2.0
scala> second_agg.show
+----+-----+----------------+-----+                                             
| id1|  id2|            maxf| minf|
+----+-----+----------------+-----+
|1498|88586|0.00238636363635|3E-14|
+----+-----+----------------+-----+

// v2.2.1
scala> second_agg.show
+----+-----+----------------+----------------+                                  
| id1|  id2|            maxf|            minf|
+----+-----+----------------+----------------+
|1498|88586|3.95833333330000|2.00000000000000|
+----+-----+----------------+----------------+

// v2.3.0
scala> second_agg.show
+----+-----+----------------+----------------+
| id1|  id2|            maxf|            minf|
+----+-----+----------------+----------------+
|1498|88586|3.95833333330000|2.00000000000000|
+----+-----+----------------+----------------+

// master
scala> second_agg.show
+----+-----+----------------+----------------+
| id1|  id2|            maxf|            minf|
+----+-----+----------------+----------------+
|1498|88586|3.95833333330000|2.00000000000000|
+----+-----+----------------+----------------+
{code}

> Aggreate on Decimal Types does not work
> ---------------------------------------
>
>                 Key: SPARK-24401
>                 URL: https://issues.apache.org/jira/browse/SPARK-24401
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.2.0, 2.3.0
>            Reporter: Jorge Machado
>            Priority: Major
>         Attachments: testDF.parquet
>
>
> Hi, 
> I think I found a really ugly bug in spark when performing aggregations with 
> Decimals
> To reproduce: 
>  
> {code:java}
> val df = spark.read.parquet("attached file")
> val first_agg = fact_df.groupBy("id1", "id2", 
> "start_date").agg(mean("projection_factor").alias("projection_factor"))
> first_agg.show
> val second_agg = 
> first_agg.groupBy("id1","id2").agg(max("projection_factor").alias("maxf"), 
> min("projection_factor").alias("minf"))
> second_agg.show
> {code}
> First aggregation works fine the second aggregation seems to be summing 
> instead of max value. I tried with spark 2.2.0 and 2.3.0 same problem.
> The dataset as circa 800 Rows and the projection_factor has values from 0 
> until 100. the result should not be bigger that 5 but with get 
> 265820543091454.... as result back.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to