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

Coalesce function with more than one aggregation function throws InternalError

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • 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

            Unassigned Unassigned
            blrunner JaeHwa Jung
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: