Jaehwa Jung created TAJO-2094:
---------------------------------

             Summary: Coalesce function with more than one aggregation function 
throws InternalError
                 Key: TAJO-2094
                 URL: https://issues.apache.org/jira/browse/TAJO-2094
             Project: Tajo
          Issue Type: Bug
          Components: Function/UDF, Planner/Optimizer
            Reporter: Jaehwa Jung


When using {{coalesce}} function with more than one aggregation function, Tajo 
throws InternalError as following:

{code:xml}
default> select l_orderkey
> , coalesce(sum1, null, 0) as final_sum1
> from (
>   select l_orderkey
>     , max(sum(case when l_linestatus = 'O' then l_extendedprice end)) as sum1
>     , max(sum(case when l_linestatus = 'F' then l_extendedprice end)) as sum2
>   from lineitem
>   where l_shipdate >= '1996-01-01'
>   and l_shipdate <= '1996-01-31'
>   group by l_orderkey 
> ) t;
[=====================>                    ] 50%  2.14 sec
ERROR: internal error: Cannot execute aggregation function in generic expression
{code}

But following queries which include one {{coalesce}} function and one 
aggregation function ran successfully as expected.

{code:xml}
select l_orderkey
, coalesce(sum1, null, 0) as final_sum1
from (
  select l_orderkey
    , max(case when l_linestatus = 'O' then l_extendedprice end) as sum1
    , max(case when l_linestatus = 'F' then l_extendedprice end) as sum2
  from lineitem
  where l_shipdate >= '1996-01-01'
  and l_shipdate <= '1996-01-31'
  group by l_orderkey 
) t;

select l_orderkey
, coalesce(sum1, null, 0) as final_sum1
from (
  select l_orderkey
    , sum(case when l_linestatus = 'O' then l_extendedprice end) as sum1
    , sum(case when l_linestatus = 'F' then l_extendedprice end) as sum2
  from lineitem
  where l_shipdate >= '1996-01-01'
  and l_shipdate <= '1996-01-31'
  group by l_orderkey 
) t;
{code}



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

Reply via email to