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 E72A7200C5A for ; Tue, 18 Apr 2017 17:15:43 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E604D160B90; Tue, 18 Apr 2017 15:15:43 +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 39C7A160BA1 for ; Tue, 18 Apr 2017 17:15:43 +0200 (CEST) Received: (qmail 55860 invoked by uid 500); 18 Apr 2017 15:15:42 -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 55837 invoked by uid 99); 18 Apr 2017 15:15:41 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Apr 2017 15:15:41 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 69953185E70 for ; Tue, 18 Apr 2017 15:15:41 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-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 (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 3P70-YD-GWtQ for ; Tue, 18 Apr 2017 15:15:40 +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 ED7EF5F5FD for ; Tue, 18 Apr 2017 15:15:39 +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 v3IFFWFu024202; Tue, 18 Apr 2017 15:15:32 GMT Message-Id: <201704181515.v3IFFWFu024202@ip-10-146-233-104.ec2.internal> Date: Tue, 18 Apr 2017 15:15:32 +0000 From: "Thomas Tauber-Marshall (Code Review)" To: impala-cr@cloudera.com, reviews@impala.incubator.apache.org CC: Alex Behm Reply-To: tmarshall@cloudera.com X-Gerrit-MessageType: newpatchset Subject: =?UTF-8?Q?=5BImpala-ASF-CR=5D_IMPALA-5125=3A_SimplifyConditionalsRule_incorrectly_handles_aggregates=0A?= X-Gerrit-Change-Id: Ic20b1621753980b47a612e0885804363b733f6da X-Gerrit-ChangeURL: X-Gerrit-Commit: c5bf46f5be3796edd7932b6a6230e976014cae73 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: Tue, 18 Apr 2017 15:15:44 -0000 Thomas Tauber-Marshall has uploaded a new patch set (#2). Change subject: IMPALA-5125: SimplifyConditionalsRule incorrectly handles aggregates ...................................................................... IMPALA-5125: SimplifyConditionalsRule incorrectly handles aggregates This patch addresses 3 issues: - SelectList.reset() didn't properly reset some of its members, though they're documented as needing to be reset. This was causing a crash when the Planner attempted to make an aggregation node for an agg function that had been eliminated by expr rewriting. While I'm here, I added resetting of all of SelectList's members that need to be reset, and fixed the documentation of one member that shouldn't be reset. - SimplifyConditionalsRule was changing the meaning of queries that contain agg functions, e.g. because "select if(true, 0, sum(id))" is not equivalent to "select 0". The fix is to not return the simplfied expr if it removes all aggregates. - ExprRewriteRulesTest was performing rewrites on the result exprs of the SelectStmt, which causes problems if the result exprs have been substituted. In normal query execution, we don't rewrite the result exprs anyway, so the fix is to match normal query execution and rewrite the select list exprs. Testing: - Added e2e test to exprs.test. - Added unit test to ExprRewriteRulesTest. Change-Id: Ic20b1621753980b47a612e0885804363b733f6da --- M fe/src/main/java/org/apache/impala/analysis/SelectStmt.java M fe/src/main/java/org/apache/impala/rewrite/SimplifyConditionalsRule.java M fe/src/test/java/org/apache/impala/analysis/ExprRewriteRulesTest.java M testdata/workloads/functional-query/queries/QueryTest/exprs.test 4 files changed, 41 insertions(+), 10 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/53/6653/2 -- To view, visit http://gerrit.cloudera.org:8080/6653 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ic20b1621753980b47a612e0885804363b733f6da Gerrit-PatchSet: 2 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Thomas Tauber-Marshall Gerrit-Reviewer: Alex Behm