Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id EBBDA200BC8 for ; Wed, 9 Nov 2016 01:17:58 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id EA496160B0C; Wed, 9 Nov 2016 00:17:58 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3B8E8160B0A for ; Wed, 9 Nov 2016 01:17:58 +0100 (CET) Received: (qmail 63665 invoked by uid 500); 9 Nov 2016 00:17:57 -0000 Mailing-List: contact dev-help@impala.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@impala.incubator.apache.org Delivered-To: mailing list dev@impala.incubator.apache.org Received: (qmail 63649 invoked by uid 99); 9 Nov 2016 00:17:57 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Nov 2016 00:17:57 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id B79E1CA6C0 for ; Wed, 9 Nov 2016 00:17:56 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.98 X-Spam-Level: * X-Spam-Status: No, score=1.98 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=cloudera-com.20150623.gappssmtp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id iONHl05ys7KL for ; Wed, 9 Nov 2016 00:17:54 +0000 (UTC) Received: from mail-oi0-f51.google.com (mail-oi0-f51.google.com [209.85.218.51]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 5CEA25FCA2 for ; Wed, 9 Nov 2016 00:17:54 +0000 (UTC) Received: by mail-oi0-f51.google.com with SMTP id 62so220383283oif.1 for ; Tue, 08 Nov 2016 16:17:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudera-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=CAvj8pzGC3CuGKytK3IWryLstNUcfIz33LQzSijWWco=; b=INGeCkLBui5Bxb70pYQxPWLLXnbSj2q9YZAA/pAJre4YBu4KSo1yJSY7Gvj8IG20YI PUokzF14ajKNixuKcr9mB1hy0Nbk/u+TSx+hyY1I21fhTLDpYLP8J8t3D/KkZk0Ngzsv 8X05bA2j/ZXVARCRkHt2sBBt9pp4t9Xgl1M6/g0v4YlfVIR7nviulB1caSH/4de3SvUB aqp84okllyrU3mYPeoQwbc53WrhZtnBTGqKkCPzFkelI1uBZkDPtUuS/WoAL/rWvU296 PK53ZBrnNLQO2cIRBQDV62mAzBMHFSGdqh6HtW5sKk+aFTUa6sOvA+a8VRrfOE1tJ6RU JXzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=CAvj8pzGC3CuGKytK3IWryLstNUcfIz33LQzSijWWco=; b=R1cjX8YYhwlC/XSk1nCTv1EVTiZRm9F+0t/efLNSxZpMuVHinpMZ2838Ij43b/6iV/ WitkDDIkC58bp86SaeKNBqhm5rr5A+qNegUfqtz1S5jCFbXDwiEPkvLV6q8eoq1pfoTi 8tBfy78D3PBrXDlIJMABFn19cm/tCJ4ZBnNO18IVc8kVqNfdHAmSGXVad4k9BQT9qPzz RVt0b7nPymv3SS8eQDq8uL7mWUHbJZcJcZHW1topKVdumPRWWw8nbX7WfR21QujyuZps dC8ir1QHMmnicKr3DAhdRX4nLQN2qoLJdwrG8SP+1xKk1JZb5CHO7QyENBaDrpc03MMK uaig== X-Gm-Message-State: ABUngvduNiCsRu2FqvsXzzvjb6fggcASF5z2yFR4ALb8ZW2W5ZIgmPkpK6HjKv2KSem5CMLJ4MOHTKw+fDEPi/B2 X-Received: by 10.202.191.85 with SMTP id p82mr10034382oif.43.1478650668194; Tue, 08 Nov 2016 16:17:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.202.214.20 with HTTP; Tue, 8 Nov 2016 16:17:47 -0800 (PST) In-Reply-To: References: From: Alex Behm Date: Tue, 8 Nov 2016 16:17:47 -0800 Message-ID: Subject: Re: Impala CONCAT() behavior vs. other databases To: dev@impala.incubator.apache.org Content-Type: multipart/alternative; boundary=001a113dd232d345060540d32f0e archived-at: Wed, 09 Nov 2016 00:17:59 -0000 --001a113dd232d345060540d32f0e Content-Type: text/plain; charset=UTF-8 My guess is that Impala's current behavior is for compatibility with Hive. Hive's concat() behaves like you described. I don't really like the behavior. So in that sense, I think the current behavior is intended, albeit questionable. On Tue, Nov 8, 2016 at 11:46 AM, Michael Brown wrote: > Hello, > > While using the Impala random query generator to compare Impala query > results with PostgreSQL query results, I noticed a discrepancy between > the CONCAT() functions. I'm looking for information from the community > whether the discrepancy I found is intentional (in which case I will > fix the random query generator) or unintentional (in which case I will > file an Impala defect Jira). I couldn't find bugs about this, though I > did see IMPALA-452, but IMPALA-452 doesn't explicitly call out > behavior discrepancies or preferences. > > If Impala CONCAT() has an argument that evaluates to NULL, then Impala > CONCAT() returns NULL. > > If PostgreSQL CONCAT() has an argument that evaluates to NULL, then > PostgreSQL will ignore it, and treat it as an empty string. Even > CONCAT(NULL) evaluates to the empty string. > > PostgreSQL has a || operator that behaves like Impala CONCAT(): if a > NULL expression is on one side of ||, that || evals to NULL. (Aside: > the || operator in Impala appears to be an alias for OR, though that > seems to be undocumented. IMPALA-452 suggests this is a Hive mimic.) > > I also checked Oracle (XE 11.2.0.2.0). Oracle also has a CONCAT() > function and a string concatenation operator ||. They are equivalent. > There is a difference between Oracle behavior and other databases: a > CONCAT() or || with only nulls or empty strings evaluates to NULL. > That's somewhat different edge behavior, but the CONCAT('something', > NULL) case does mimic PostgreSQL CONCAT(), not Impala CONCAT(). > > If Impala CONCAT() is meant to behave like PostgreSQL ||, then I can > change the random query generator to write the correct SQL dialect > from the same logical query to reduce false positive discrepancies. If > Impala CONCAT() is meant to behave like PostgreSQL CONCAT(), then > there's a defect. Please let me know the intent so I can act > accordingly. > > Thanks! > --001a113dd232d345060540d32f0e--