[ 
https://issues.apache.org/jira/browse/KYLIN-4620?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zhong Yanghong updated KYLIN-4620:
----------------------------------
    Description: 
In standard sql, there's an edge case for the calculation of expression for a 
single row. For example, 
{code:java}
${col1} + ${col2}

{code}
if ${col1} or ${col2} is null, the result of this expression should be null. 
Therefore, the sum aggregation function does not conform the associative law of 
addition. That is
{code:java}
sum(col1) + sum(col2) != sum(col1 + col2) 

{code}
 

To support sum(col1 + col2), we have to predefine the it if null values may 
exist for the related columns.

If you want to enable sum(expression) with regarding null as 0, you need to set 
kylin.query.is-null-as-zero-in-expression to be true at project level

  was:
In standard sql, there's an edge case for the calculation of expression for a 
single row. For example, 
{code:java}
${col1} + ${col2}

{code}
if ${col1} or ${col2} is null, the result of this expression should be null. 
Therefore, the sum aggregation function does not conform the associative law of 
addition. That is
{code:java}
sum(col1) + sum(col2) != sum(col1 + col2) 

{code}
 

To support sum(col1 + col2), we have to predefine the it if null values may 
exist for the related columns.


> sum(expression) support should be limited since it's not conform the 
> associative law of addition in standard sql
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: KYLIN-4620
>                 URL: https://issues.apache.org/jira/browse/KYLIN-4620
>             Project: Kylin
>          Issue Type: Improvement
>            Reporter: Zhong Yanghong
>            Assignee: Zhong Yanghong
>            Priority: Major
>
> In standard sql, there's an edge case for the calculation of expression for a 
> single row. For example, 
> {code:java}
> ${col1} + ${col2}
> {code}
> if ${col1} or ${col2} is null, the result of this expression should be null. 
> Therefore, the sum aggregation function does not conform the associative law 
> of addition. That is
> {code:java}
> sum(col1) + sum(col2) != sum(col1 + col2) 
> {code}
>  
> To support sum(col1 + col2), we have to predefine the it if null values may 
> exist for the related columns.
> If you want to enable sum(expression) with regarding null as 0, you need to 
> set kylin.query.is-null-as-zero-in-expression to be true at project level



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to