Uploaded image for project: 'Kylin'
  1. Kylin
  2. KYLIN-3967

sum along with case expression does not work in query

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Not A Problem
    • None
    • None
    • Query Engine
    • None
    • Important

    Description

      When i try to run a query with a sum case expression combination,

      eg: select sum(case when col1<0 then 0 else col1 end ) from table 

      i get the following error:

      No realization found for OLAPContext, CUBE_UNMATCHED_AGGREGATION[FunctionDesc [expression=SUM, parameter=CASE(<($8, 0), 0, $8), returnType=null]], rel#36838:OLAPTableScan.OLAP.[](table=[DEFAULT, table],ctx=,fields=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106]) while executing SQL: "select sum (case when col1 <0 then 0 else col1 end ) from table LIMIT 50000"

       

      is there any way to support this sum case expression in the query engine?

      Also I get the same error when the sum operation is done on a column derived from a case expression in a subquery.

      eg: select sum(a.col1) from (select case when col1<0 then 0 else col1 end as col1 from table) a

      Thanks,

      Gladson

       

      Attachments

        1. notworkingcase.jpg
          76 kB
          Gladson Vas
        2. workingcase.jpg
          77 kB
          Gladson Vas

        Activity

          People

            Unassigned Unassigned
            gladson.vas Gladson Vas
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: