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

Mehant Baid commented on DRILL-2870:
------------------------------------

[~jnadeau] I can come up with a few alternatives but I wanted to point out that 
the running type of the aggregate is still a required type. So we are not 
paying a cost on a per row basis, the only difference is when we set the output 
vector we will have to do an additional set operation in the bits vector to 
indicate value is not null. Since this happens only on at a batch level it 
seems fine. 

> Fix return type of aggregate functions to be nullable
> -----------------------------------------------------
>
>                 Key: DRILL-2870
>                 URL: https://issues.apache.org/jira/browse/DRILL-2870
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Mehant Baid
>            Assignee: Aman Sinha
>            Priority: Critical
>             Fix For: 1.0.0
>
>         Attachments: DRILL-2870.patch
>
>
> The output type of aggregate functions is required if the input is required 
> which does not always hold true. Consider the case where input is a required 
> type and we are performing sum(), however if all the rows are filtered out 
> then we should return null instead of 0. This holds true for all aggregate 
> functions (except count). 
> As part of DRILL-2277 we are fixing the case when we have an aggregate 
> function (without group by) and the input batch is empty we still need to 
> produce one record with null as output (count function is an exception to 
> this). If we don't fix the return type of aggregate functions then we will 
> return wrong results in the case where we have an empty input with required 
> columns. 



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

Reply via email to