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 E1FC1200BC2 for ; Thu, 3 Nov 2016 06:22:37 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id E094C160B0A; Thu, 3 Nov 2016 05:22:37 +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 349E8160AFB for ; Thu, 3 Nov 2016 06:22:37 +0100 (CET) Received: (qmail 75000 invoked by uid 500); 3 Nov 2016 05:22:36 -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 74985 invoked by uid 99); 3 Nov 2016 05:22:36 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Nov 2016 05:22:36 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id AB32EC07CC for ; Thu, 3 Nov 2016 05:22:35 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-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-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id D754_P9RMrjm for ; Thu, 3 Nov 2016 05:22:33 +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 ED4E55FC1A for ; Thu, 3 Nov 2016 05:22:32 +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 uA35MVsO020021; Thu, 3 Nov 2016 05:22:31 GMT Message-Id: <201611030522.uA35MVsO020021@ip-10-146-233-104.ec2.internal> Date: Thu, 3 Nov 2016 05:22:31 +0000 From: "Alex Behm (Code Review)" To: impala-cr@cloudera.com, reviews@impala.incubator.apache.org CC: Bharath Vissapragada , Marcel Kornacker , Tim Armstrong Reply-To: alex.behm@cloudera.com X-Gerrit-MessageType: comment Subject: =?UTF-8?Q?=5BImpala-ASF-CR=5D_IMPALA-1286=3A_Extract_common_conjuncts_from_disjunctions=2E=0A?= X-Gerrit-Change-Id: I3cf9b950afaa3fd753d1b09ba5e540b5258940ad X-Gerrit-ChangeURL: X-Gerrit-Commit: 8b5307af500a457375774a2b782c1e905b455e24 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: Thu, 03 Nov 2016 05:22:38 -0000 Alex Behm has posted comments on this change. Change subject: IMPALA-1286: Extract common conjuncts from disjunctions. ...................................................................... Patch Set 2: (7 comments) http://gerrit.cloudera.org:8080/#/c/4877/2/fe/src/main/java/org/apache/impala/analysis/AnalysisContext.java File fe/src/main/java/org/apache/impala/analysis/AnalysisContext.java: Line 70: BetweenToCompoundRule.INSTANCE, ExtractCommonConjunctRule.INSTANCE); > for added effectiveness you want the between rule to be applied before the Done http://gerrit.cloudera.org:8080/#/c/4877/2/fe/src/main/java/org/apache/impala/analysis/Subquery.java File fe/src/main/java/org/apache/impala/analysis/Subquery.java: Line 155: return stmt_.toSql().equals(((Subquery)o).stmt_.toSql()); > hm, that seems a bit fragile, won't insignificant syntactic differences (su Agree, somewhat fragile. But correct. This change exposed an existing bug involving the lack of a proper Subquery.equals(). I filed a separate JIRA and CR for that bug. Added the TODO to that patch which should go in before this one. Bugfix CR: http://gerrit.cloudera.org:8080/4923 http://gerrit.cloudera.org:8080/#/c/4877/1/fe/src/main/java/org/apache/impala/rewrite/ExtractCommonConjunctRule.java File fe/src/main/java/org/apache/impala/rewrite/ExtractCommonConjunctRule.java: Line 31: * Extracts common conjuncts from a single disjunctive CompoundPredicate. > I agree we don't need to document the framework here, but I think it's non- Used your wording verbatim. http://gerrit.cloudera.org:8080/#/c/4877/2/fe/src/main/java/org/apache/impala/rewrite/ExtractCommonConjunctRule.java File fe/src/main/java/org/apache/impala/rewrite/ExtractCommonConjunctRule.java: Line 51: List child0Conjuncts = expr.getChild(0).getConjuncts(); > checkstate that the child conjuncts aren't empty? Added Preconditions check. Like Tim mentioned this sounds like a "simplification" normalization rule that would work together with constant folding. Arguably, your example does not fit this rule because there are no common conjuncts. Line 51: List child0Conjuncts = expr.getChild(0).getConjuncts(); > true or x => true seems like a normalisation rule we should add in a follow Good point. Line 62: conjunct.setPrintSqlInParens(false); > add comment: why Done http://gerrit.cloudera.org:8080/#/c/4877/1/fe/src/test/java/org/apache/impala/analysis/ExprRewriteRulesTest.java File fe/src/test/java/org/apache/impala/analysis/ExprRewriteRulesTest.java: Line 146: "(!(int_col=5 or tinyint_col > 9) and double_col = 7) or " + > I think we should just be mindful that this change without normalisation ad Good point about the perf cliff. I think it's doable to squeeze in a few simple normalization rules, e.g. for BinaryPredicates. Agree that constant folding will need normalization as well for maximal effectiveness, e.g., 1 + a + 10 I was actually thinking of doing constant folding next (without handling that case above), unless you want to take it on instead. -- To view, visit http://gerrit.cloudera.org:8080/4877 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3cf9b950afaa3fd753d1b09ba5e540b5258940ad Gerrit-PatchSet: 2 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Alex Behm Gerrit-Reviewer: Alex Behm Gerrit-Reviewer: Bharath Vissapragada Gerrit-Reviewer: Marcel Kornacker Gerrit-Reviewer: Tim Armstrong Gerrit-HasComments: Yes