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

Keuntae Park commented on TAJO-1265:
------------------------------------

It seems that it is not a simple task to make a patch especially when it deals 
empty table cases.

According ANSI SQL standard, for empty table,
min(), max(), sum(), avg() return null, however, count() returns 0.

Currently, getEmptyTuple() in DistinctGroupbySortAggregationExec.java makes all 
the aggregation result for empty table as scalar value.
It should be changed to return null for min, max, sum, avg() and 0 for count().
And sum, avg() code should also be changed to correctly handle null value.

As I'm not familiar with this part of code, it will need more time to make a 
patch.

Please let me know if I mistake on some point or having any comments. 

> min(), max() does not handle null properly
> ------------------------------------------
>
>                 Key: TAJO-1265
>                 URL: https://issues.apache.org/jira/browse/TAJO-1265
>             Project: Tajo
>          Issue Type: Bug
>            Reporter: Keuntae Park
>            Assignee: Keuntae Park
>            Priority: Minor
>
> In other DBs like oracle and postgreSQL, 
> null is excluded from calculation of min() and max() value until there is no 
> non-null value in the given column, in which case, it returns null. 
> However, current implementation of Tajo considers null as
> 0 for int or long column, 0.0 for float or double column, or "" for text 
> column.
> It needs to handle null value separately from non-null values in min() and 
> max() calculation. 



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

Reply via email to