-
Type:
Bug
-
Status: Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Function/UDF, Planner/Optimizer
-
Labels:None
When using coalesce function with more than one aggregation function, Tajo throws InternalError as following:
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
But following queries which include one coalesce function and one aggregation function ran successfully as expected.
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;