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 9F44F200CF8 for ; Thu, 14 Sep 2017 22:41:35 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9E4AF1609CE; Thu, 14 Sep 2017 20:41:35 +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 E5C1F1609C6 for ; Thu, 14 Sep 2017 22:41:34 +0200 (CEST) Received: (qmail 49785 invoked by uid 500); 14 Sep 2017 20:41:32 -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 49774 invoked by uid 99); 14 Sep 2017 20:41:32 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Sep 2017 20:41:32 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id D3E071A6918 for ; Thu, 14 Sep 2017 20:41:31 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-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-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 7kyDbKvDYtKD for ; Thu, 14 Sep 2017 20:41:29 +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-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id D560F5FAF7 for ; Thu, 14 Sep 2017 20:41:28 +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 v8EKfRjB017337; Thu, 14 Sep 2017 20:41:27 GMT Message-Id: <201709142041.v8EKfRjB017337@ip-10-146-233-104.ec2.internal> Date: Thu, 14 Sep 2017 20:41:26 +0000 From: "Philip Zeyliger (Code Review)" To: Matthew Jacobs , impala-cr@cloudera.com, reviews@impala.incubator.apache.org CC: Alex Behm Reply-To: philip@cloudera.com X-Gerrit-MessageType: newpatchset Subject: =?UTF-8?Q?=5BImpala-ASF-CR=5D_IMPALA-5211=3A_Simplifying_nullif_conditional=2E=0A?= X-Gerrit-Change-Id: Id91ca968a0c0be44e1ec54ad8602f91a5cb2e0e5 X-Gerrit-ChangeURL: X-Gerrit-Commit: 69756d3e8b6d53bac94455069596e10847166abd In-Reply-To: References: 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: Thu, 14 Sep 2017 20:41:35 -0000 Hello Matthew Jacobs, I'd like you to reexamine a change. Please visit http://gerrit.cloudera.org:8080/7829 to look at the new patch set (#8). Change subject: IMPALA-5211: Simplifying nullif conditional. ...................................................................... IMPALA-5211: Simplifying nullif conditional. This commit: * Converts nullif(x, y) into if(x IS DISTINCT FROM y, x, NULL). * Re-writes x IS DINSTINCT FROM y -> FALSE if x.equals(y). * Removes backend implementation of nullif. As is the case with all conversions, the original nullif(...) is replaced with if(...) in error messages, explain plans, and so on. It's important and subtle that the conversion uses "x IS DISTINCT FROM y" rather than "x != y" so that the simplification can be made while handling null values correctly. ("x != x" may be either false or null, but x is distinct from x is always false.) Testing: * Added new tests to ExprRewriteRulesTests for nullif and the if(x distinct from y, ...) simplification. * New test for the rewrite in ParserTest. * Adds an nvl2() test, incidentally. * Confirmed (using EclEmma, which uses jococo engine) that coverage is good. * Ran the tests. Change-Id: Id91ca968a0c0be44e1ec54ad8602f91a5cb2e0e5 --- M be/src/exprs/conditional-functions-ir.cc M be/src/exprs/conditional-functions.cc M be/src/exprs/conditional-functions.h M be/src/exprs/scalar-expr.cc M be/src/exprs/scalar-expr.h M common/function-registry/impala_functions.py M fe/src/main/java/org/apache/impala/analysis/Analyzer.java M fe/src/main/java/org/apache/impala/analysis/FunctionCallExpr.java M fe/src/main/java/org/apache/impala/rewrite/BetweenToCompoundRule.java M fe/src/main/java/org/apache/impala/rewrite/EqualityDisjunctsToInRule.java M fe/src/main/java/org/apache/impala/rewrite/ExtractCommonConjunctRule.java M fe/src/main/java/org/apache/impala/rewrite/NormalizeBinaryPredicatesRule.java M fe/src/main/java/org/apache/impala/rewrite/NormalizeCountStarRule.java M fe/src/main/java/org/apache/impala/rewrite/NormalizeExprsRule.java M fe/src/main/java/org/apache/impala/rewrite/SimplifyConditionalsRule.java A fe/src/main/java/org/apache/impala/rewrite/SimplifyDistinctFromRule.java M fe/src/test/java/org/apache/impala/analysis/AnalyzeExprsTest.java M fe/src/test/java/org/apache/impala/analysis/ExprRewriteRulesTest.java M fe/src/test/java/org/apache/impala/analysis/ParserTest.java 19 files changed, 213 insertions(+), 122 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/29/7829/8 -- To view, visit http://gerrit.cloudera.org:8080/7829 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Id91ca968a0c0be44e1ec54ad8602f91a5cb2e0e5 Gerrit-PatchSet: 8 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Philip Zeyliger Gerrit-Reviewer: Alex Behm Gerrit-Reviewer: Matthew Jacobs Gerrit-Reviewer: Philip Zeyliger