Return-Path: X-Original-To: apmail-drill-issues-archive@minotaur.apache.org Delivered-To: apmail-drill-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CC64717C7B for ; Sat, 28 Feb 2015 05:58:04 +0000 (UTC) Received: (qmail 65367 invoked by uid 500); 28 Feb 2015 05:58:04 -0000 Delivered-To: apmail-drill-issues-archive@drill.apache.org Received: (qmail 65338 invoked by uid 500); 28 Feb 2015 05:58:04 -0000 Mailing-List: contact issues-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 issues@drill.apache.org Received: (qmail 65325 invoked by uid 99); 28 Feb 2015 05:58:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 28 Feb 2015 05:58:04 +0000 Date: Sat, 28 Feb 2015 05:58:04 +0000 (UTC) From: "Sean Hsuan-Yi Chu (JIRA)" To: issues@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (DRILL-2328) Concat operator returns wrong result when one of the operands is 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-2328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sean Hsuan-Yi Chu updated DRILL-2328: ------------------------------------- Attachment: DRILL-2328.1.patch We should be more aligned with Postgres. A simple patch! > Concat operator returns wrong result when one of the operands is NULL > --------------------------------------------------------------------- > > Key: DRILL-2328 > URL: https://issues.apache.org/jira/browse/DRILL-2328 > Project: Apache Drill > Issue Type: Bug > Components: Query Planning & Optimization > Affects Versions: 0.8.0 > Reporter: Victoria Markman > Assignee: Sean Hsuan-Yi Chu > Priority: Critical > Attachments: DRILL-2328.1.patch > > > Queries below should return NULL: > {code} > 0: jdbc:drill:schema=dfs> select cast(null as varchar(10)) || '--' from t1; > +------------+ > | EXPR$0 | > +------------+ > | -- | > | -- | > | -- | > | -- | > | -- | > | -- | > | -- | > | -- | > | -- | > | -- | > +------------+ > 10 rows selected (0.09 seconds) > 0: jdbc:drill:schema=dfs> select a1 || '--' from t1 where a1 is null; > +------------+ > | EXPR$0 | > +------------+ > | -- | > +------------+ > 1 row selected (0.105 seconds) > {code} > Looks harmless at first, but a very common pattern in many customer queries will be broken: grouping by using '||' as following: > {code} > select > cast(extract(day from c_timestamp) as varchar(10)) || '-' || cast(extract(month from c_timestamp) as varchar(10)) || '-' || cast(extract(year from c_timestamp) as varchar(10)), > sum(c_integer) as sum1 > from > alltypes_with_nulls > group by > cast(extract(day from c_timestamp) as varchar(10)) || '-' || cast(extract(month from c_timestamp) as varchar(10)) || '-' || cast(extract(year from c_timestamp) as varchar(10)) > order by > cast(extract(day from c_timestamp) as varchar(10)) || '-' || cast(extract(month from c_timestamp) as varchar(10)) || '-' || cast(extract(year from c_timestamp) as varchar(10)) > ; > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)