You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kylin.apache.org by "Anoop Krishnaswamy (JIRA)" <ji...@apache.org> on 2019/04/29 14:33:00 UTC

[jira] [Created] (KYLIN-3993) Sum over a case statement fails with integer data type

Anoop Krishnaswamy created KYLIN-3993:
-----------------------------------------

             Summary: Sum over a case statement fails with integer data type
                 Key: KYLIN-3993
                 URL: https://issues.apache.org/jira/browse/KYLIN-3993
             Project: Kylin
          Issue Type: Bug
          Components: Driver - ODBC
    Affects Versions: v2.6.1
            Reporter: Anoop Krishnaswamy


Hi,

When we use sum over a case statement, it works when the field is of a certain type like decimal(19,3). But the same fails when used with integer field:

This works:

select sum(case when balance_indicator='1' then cyc_xxx_balanceadbavg else 0 end) , balance_indicator from fct_profit_table_quarterly
group by balance_indicator

Whereas the below sql fails

select sum(case when balance_indicator='1' then accountmonthsopen else 0 end) , balance_indicator from fct_profit_table_quarterly
group by balance_indicator

 

with the error message:

{color:#b94a48}java.math.BigDecimal cannot be cast to java.lang.Integer while executing SQL: "select sum(case when balance_indicator='1' then accountmonthsopen else 0 end) , balance_indicator from fct_profit_table_quarterly group by balance_indicator LIMIT 50000"{color}

 

{color:#b94a48}The difference between 1st sql and 2nd sql being - in the first query the metric used in the case statement is of decimal(19,4) and the metric used in 2nd statement is of type int.{color}

 

{color:#b94a48}Kindly help{color}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)