[
https://issues.apache.org/jira/browse/SPARK-14664?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Herman van Hovell resolved SPARK-14664.
---------------------------------------
Resolution: Fixed
Assignee: Dongjoon Hyun
Fix Version/s: 2.0.0
> Implement DecimalAggregates optimization for Window queries
> -----------------------------------------------------------
>
> Key: SPARK-14664
> URL: https://issues.apache.org/jira/browse/SPARK-14664
> Project: Spark
> Issue Type: Bug
> Components: Optimizer
> Reporter: Dongjoon Hyun
> Assignee: Dongjoon Hyun
> Priority: Critical
> Fix For: 2.0.0
>
>
> This issue aims to implement decimal aggregation optimization for window
> queries by improving existing `DecimalAggregates`. Historically,
> `DecimalAggregates` optimizer is designed to transform general
> `sum/avg(decimal)`, but it breaks recently added windows queries like the
> followings. The following queries work well without the current
> `DecimalAggregates` optimizer.
> *Sum*
> {code}
> scala> sql("select sum(a) over () from (select explode(array(1.0,2.0)) a)
> t").head
> java.lang.RuntimeException: Unsupported window function:
> MakeDecimal((sum(UnscaledValue(a#31)),mode=Complete,isDistinct=false),12,1)
> {code}
> *Average*
> {code}
> scala> sql("select avg(a) over () from (select explode(array(1.0,2.0)) a)
> t").head
> java.lang.RuntimeException: Unsupported window function:
> cast(((avg(UnscaledValue(a#40)),mode=Complete,isDistinct=false) / 10.0) as
> decimal(6,5))
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]