impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Behm (Code Review)" <>
Subject [Impala-ASF-CR] IMPALA-1286: Extract common conjuncts from disjunctions.
Date Thu, 03 Nov 2016 05:22:31 GMT
Alex Behm has posted comments on this change.

Change subject: IMPALA-1286: Extract common conjuncts from disjunctions.

Patch Set 2:

File fe/src/main/java/org/apache/impala/analysis/

Line 70:         BetweenToCompoundRule.INSTANCE, ExtractCommonConjunctRule.INSTANCE);
> for added effectiveness you want the between rule to be applied before the 
File fe/src/main/java/org/apache/impala/analysis/

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:
File fe/src/main/java/org/apache/impala/rewrite/

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.
File fe/src/main/java/org/apache/impala/rewrite/

Line 51:     List<Expr> 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<Expr> 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
File fe/src/test/java/org/apache/impala/analysis/

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
To unsubscribe, visit

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

View raw message