You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Dongjoon Hyun (JIRA)" <ji...@apache.org> on 2016/04/15 19:56:25 UTC

[jira] [Updated] (SPARK-14664) Fix DecimalAggregates optimizer not to break Window queries

     [ https://issues.apache.org/jira/browse/SPARK-14664?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dongjoon Hyun updated SPARK-14664:
----------------------------------
    Description: 
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.

  was:
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.


> 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: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org