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 5A0BA200BF5 for ; Sat, 7 Jan 2017 22:29:33 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 4D9FB160B3C; Sat, 7 Jan 2017 21:29:33 +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 945E9160B27 for ; Sat, 7 Jan 2017 22:29:32 +0100 (CET) Received: (qmail 6335 invoked by uid 500); 7 Jan 2017 21:29:31 -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 6322 invoked by uid 99); 7 Jan 2017 21:29:31 -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; Sat, 07 Jan 2017 21:29:31 +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 EB1D81A04B9 for ; Sat, 7 Jan 2017 21:29:30 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.363 X-Spam-Level: X-Spam-Status: No, score=0.363 tagged_above=-999 required=6.31 tests=[RDNS_DYNAMIC=0.363, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id a7v9eozL5z1B for ; Sat, 7 Jan 2017 21:29:30 +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 B8A705F477 for ; Sat, 7 Jan 2017 21:29:29 +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 v07LTOdl019908; Sat, 7 Jan 2017 21:29:24 GMT Message-Id: <201701072129.v07LTOdl019908@ip-10-146-233-104.ec2.internal> Date: Sat, 7 Jan 2017 21:29:24 +0000 From: "Marcel Kornacker (Code Review)" To: Thomas Tauber-Marshall , impala-cr@cloudera.com, reviews@impala.incubator.apache.org CC: Alex Behm Reply-To: marcel@cloudera.com X-Gerrit-MessageType: comment Subject: =?UTF-8?Q?=5BImpala-ASF-CR=5D_IMPALA-1861=3A_Simplify_conditionals_with_constant_conditions=0A?= X-Gerrit-Change-Id: Id70aaf9fd99f64bd98175b7e2dbba28f350e7d3b X-Gerrit-ChangeURL: X-Gerrit-Commit: 8dbbb066ce33a2473f90d0caaf6b15f700f21baa 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.2 archived-at: Sat, 07 Jan 2017 21:29:33 -0000 Marcel Kornacker has posted comments on this change. Change subject: IMPALA-1861: Simplify conditionals with constant conditions ...................................................................... Patch Set 3: (5 comments) http://gerrit.cloudera.org:8080/#/c/5585/3/fe/src/main/java/org/apache/impala/rewrite/SimplifyConditionalsRule.java File fe/src/main/java/org/apache/impala/rewrite/SimplifyConditionalsRule.java: Line 133: boolean foundFalseExpr = false; briefly explain why this is needed (indicates that case can be simplified) Line 140: if (caseExpr.isLiteral() && expr.getChild(i).isLiteral()) { > it looks like expr.hasCaseExpr() && !caseExpr.isLiteral() means you'll neve one more thing: for 'case []' you can remove all 'when null' branches. this applies even to non-literal case exprs (which won't trigger l159). Line 144: whenExpr = analyzer.getConstantFolder().rewrite(pred, analyzer); > this is a roundabout way to get a boolean value. use FeSupport.evalPredicat never mind, you need this for the non-const case. http://gerrit.cloudera.org:8080/#/c/5585/3/fe/src/test/java/org/apache/impala/analysis/ExprRewriteRulesTest.java File fe/src/test/java/org/apache/impala/analysis/ExprRewriteRulesTest.java: Line 239: public void TestSimplifyConditionalsRule() throws AnalysisException { for each conditional, also add a test case that doesn't allow any rewrites. Line 262: RewritesOk("case 3 when 0 then id when 1 then id + 1 end", rule, "NULL"); > add 'case null' also add statement with multiple matches. -- To view, visit http://gerrit.cloudera.org:8080/5585 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id70aaf9fd99f64bd98175b7e2dbba28f350e7d3b Gerrit-PatchSet: 3 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Thomas Tauber-Marshall Gerrit-Reviewer: Alex Behm Gerrit-Reviewer: Marcel Kornacker Gerrit-Reviewer: Thomas Tauber-Marshall Gerrit-HasComments: Yes