Uploaded image for project: 'Tajo'
  1. Tajo
  2. TAJO-2094

Coalesce function with more than one aggregation function throws InternalError

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      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;
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              blrunner Jaehwa Jung
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: