Dongjoon Hyun created SPARK-14664:
-------------------------------------

             Summary: Fix DecimalAggregates optimizer not to break Window 
queries
                 Key: SPARK-14664
                 URL: https://issues.apache.org/jira/browse/SPARK-14664
             Project: Spark
          Issue Type: Bug
          Components: Optimizer
            Reporter: Dongjoon Hyun
            Priority: Critical


Historically, `DecimalAggregates` optimizer is designed to transform general 
`sum/avg(decimal)`.

However, it breaks recently added windows queries like the followings. The 
following queries work well without this 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 issue aims to fix `DecimalAggregates` optimizer not to handle aggregation 
queries over windows.

Note that this issue does not aim to implement optimization over Window 
aggregation.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to