Return-Path: X-Original-To: apmail-drill-dev-archive@www.apache.org Delivered-To: apmail-drill-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0CD1417CF2 for ; Mon, 27 Apr 2015 20:52:39 +0000 (UTC) Received: (qmail 97153 invoked by uid 500); 27 Apr 2015 20:52:38 -0000 Delivered-To: apmail-drill-dev-archive@drill.apache.org Received: (qmail 97098 invoked by uid 500); 27 Apr 2015 20:52:38 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 97045 invoked by uid 99); 27 Apr 2015 20:52:38 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Apr 2015 20:52:38 +0000 Date: Mon, 27 Apr 2015 20:52:38 +0000 (UTC) From: "Mehant Baid (JIRA)" To: dev@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (DRILL-2411) Scalar SUM/AVG over empty result set returns no rows instead of NULL MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DRILL-2411?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mehant Baid resolved DRILL-2411. -------------------------------- Resolution: Fixed Fixed as part of DRILL-2277 in 3689522d4a7035a966f19695a678c6881fdaeba6 > Scalar SUM/AVG over empty result set returns no rows instead of NULL > -------------------------------------------------------------------- > > Key: DRILL-2411 > URL: https://issues.apache.org/jira/browse/DRILL-2411 > Project: Apache Drill > Issue Type: Bug > Components: Execution - Relational Operators > Reporter: Victoria Markman > Assignee: Mehant Baid > Priority: Critical > Fix For: 1.0.0 > > > Queries below should return NULL: > {code} > 0: jdbc:drill:schema=dfs> select sum(a2) from t2 where 1=0; > +------------+ > | EXPR$0 | > +------------+ > +------------+ > No rows selected (0.08 seconds) > 0: jdbc:drill:schema=dfs> select avg(a2) from t2 where 1=0; > +------------+ > | EXPR$0 | > +------------+ > +------------+ > No rows selected (0.074 seconds) > {code} > When grouped, result is correct: > {code} > 0: jdbc:drill:schema=dfs> select a2, sum(a2) from t2 where 1=0 group by a2; > +------------+------------+ > | a2 | EXPR$1 | > +------------+------------+ > +------------+------------+ > No rows selected (0.11 seconds) > {code} > I'm not convinced and it is not very intuitive that correct result should be NULL, but this is what postgres returns and Aman thinks NULL is the correct behavior :) -- This message was sent by Atlassian JIRA (v6.3.4#6332)