[ 
https://issues.apache.org/jira/browse/KYLIN-1989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15464080#comment-15464080
 ] 

hongbin ma commented on KYLIN-1989:
-----------------------------------

I can reproduce you issue now. kylin does not support case when in 
aggregators(sum,min,max) yet. Only "case when" for dimension is supported, for 
example: 


 SELECT (CASE WHEN ("TEST_KYLIN_FACT"."LSTG_FORMAT_NAME" = 'Auction') THEN 
'Auction2' ELSE "TEST_KYLIN_FACT"."LSTG_FORMAT_NAME" END) AS 
"LSTG_FORMAT_NAME__group_",
  SUM("TEST_KYLIN_FACT"."PRICE") AS "sum_PRICE_ok"
FROM "TEST_KYLIN_FACT" "TEST_KYLIN_FACT"
GROUP BY (CASE WHEN ("TEST_KYLIN_FACT"."LSTG_FORMAT_NAME" =  'Auction') THEN 
'Auction2' ELSE "TEST_KYLIN_FACT"."LSTG_FORMAT_NAME" END)


as a workaround now you can modify the "case when" to a filter

> Sum issue: result not consistent with hive
> ------------------------------------------
>
>                 Key: KYLIN-1989
>                 URL: https://issues.apache.org/jira/browse/KYLIN-1989
>             Project: Kylin
>          Issue Type: Bug
>    Affects Versions: v1.5.2
>            Reporter: Le Van Ha
>            Assignee: hongbin ma
>         Attachments: hive_result.png, kylin_result.png
>
>
>  When do the following query, 
> SELECT channel.name, sum(case when product.product_vendor <> '' then 
> fact_product.quantity else 0 end) 
> FROM fact_product_sales as fact_product 
> join dim_product as product on fact_product.product_id = product.id 
> join dim_channel as channel on fact_product.channel_id = channel.id  
> GROUP BY channel.name
> -------------------------------------------------------------------
> The result by kylin:
> Buy Button                        0
> Online Store                     0
> -------------------------------------------------------------------
> The result by hive is shown in figure.
> Why is that?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to