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 BF6CB200D0D for ; Fri, 25 Aug 2017 20:45:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id BE1E416D0B5; Fri, 25 Aug 2017 18:45:09 +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 1114816D0B1 for ; Fri, 25 Aug 2017 20:45:08 +0200 (CEST) Received: (qmail 37958 invoked by uid 500); 25 Aug 2017 18:45:08 -0000 Mailing-List: contact reviews-help@impala.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list reviews@impala.incubator.apache.org Received: (qmail 37946 invoked by uid 99); 25 Aug 2017 18:45:07 -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; Fri, 25 Aug 2017 18:45:07 +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 54FEFC63CE for ; Fri, 25 Aug 2017 18:45:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.362 X-Spam-Level: X-Spam-Status: No, score=0.362 tagged_above=-999 required=6.31 tests=[RDNS_DYNAMIC=0.363, SPF_PASS=-0.001] autolearn=disabled 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 qQhwCPb987es for ; Fri, 25 Aug 2017 18:45:06 +0000 (UTC) Received: from ip-10-146-233-104.ec2.internal (ec2-75-101-130-251.compute-1.amazonaws.com [75.101.130.251]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 694295F520 for ; Fri, 25 Aug 2017 18:45:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by ip-10-146-233-104.ec2.internal (8.14.4/8.14.4) with ESMTP id v7PIj509012368; Fri, 25 Aug 2017 18:45:05 GMT Date: Fri, 25 Aug 2017 18:45:05 +0000 From: "Philip Zeyliger (Code Review)" To: Marcel Kornacker , impala-cr@cloudera.com, reviews@impala.incubator.apache.org Message-ID: Reply-To: philip@cloudera.com X-Gerrit-MessageType: newchange Subject: =?UTF-8?Q?=5BImpala-ASF-CR=5D_IMPALA-5211=3A_Simplifying_conditionals_=28istrue=2C_nullif=2C_etc=2E=29=0A?= X-Gerrit-Change-Id: Id91ca968a0c0be44e1ec54ad8602f91a5cb2e0e5 X-Gerrit-ChangeURL: X-Gerrit-Commit: 6874a171633c405a75ef78062e6b58165163897c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/2.12.7 archived-at: Fri, 25 Aug 2017 18:45:09 -0000 Philip Zeyliger has uploaded a new change for review. http://gerrit.cloudera.org:8080/7829 Change subject: IMPALA-5211: Simplifying conditionals (istrue, nullif, etc.) ...................................................................... IMPALA-5211: Simplifying conditionals (istrue, nullif, etc.) This commit simplifies the following conditional functions: * istrue * isfalse * isnottrue * isnotfalse * zeroifnull * nullifzero * nullvalue * nonnullvalue * nullif Most of these simplifications work when the arguments to these functions are literals. The one exception is that nullif(x, y) simplifies to NULL when x.equals(y) as expressions. This is valid since nullif(null, null)=null. This simplification has not been applied to the equivalent "case x=x then null else null". In terms of the implementation is a bit of a toss-up between re-writing these into their equivalent case statements or simplifying them here. Testing: * Added new tests to ExprRewriteRulesTest * Confirmed (using EclEmma, which uses jococo engine) that coverage is good. Change-Id: Id91ca968a0c0be44e1ec54ad8602f91a5cb2e0e5 --- M fe/src/main/java/org/apache/impala/rewrite/SimplifyConditionalsRule.java M fe/src/test/java/org/apache/impala/analysis/ExprRewriteRulesTest.java 2 files changed, 200 insertions(+), 18 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/29/7829/1 -- To view, visit http://gerrit.cloudera.org:8080/7829 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id91ca968a0c0be44e1ec54ad8602f91a5cb2e0e5 Gerrit-PatchSet: 1 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Philip Zeyliger