You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2020/04/14 22:33:00 UTC

[jira] [Commented] (IMPALA-8361) Bound predicates optimization doesn't work for InlineView

    [ https://issues.apache.org/jira/browse/IMPALA-8361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17083654#comment-17083654 ] 

ASF subversion and git services commented on IMPALA-8361:
---------------------------------------------------------

Commit 74e55edd2c1a814e5ca4bfd7a60017e142f6ee98 in impala's branch refs/heads/branch-3.4.0 from xqhe
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=74e55ed ]

IMPALA-8361: Propagate predicates of outer-joined InlineView

This is an improvement that tries to propagate predicates of the
nullable side of the outer join into inline view.

For example:
SELECT *
FROM functional.alltypessmall a
    LEFT JOIN (
        SELECT id, upper(string_col) AS upper_val,
        length(string_col) AS len
        FROM functional.alltypestiny
    ) b ON a.id = b.id
WHERE b.upper_val is NULL and b.len = 0
Before this change, the predicate b.len=0 can't be migrated into inline
view since that is on the nullable side of an outer join if the
predicate evaluates in the inline view nulls will not be rejected.
However, we can be more aggressive. In particular, some predicates that
must be evaluted at a join node can also be safely evaluted by the
outer-joined inline view. Such predicates are not marked as assigned.
The predicates propagate into the inline view and also be evaluated at
a join node.

We can divide predicates into two types. One that satisfies the condition
that same as Analyzer#canEvalPredicate can be migrated into inline view,
and one that satisfies the below three conditions is safe to be propagated
into the nullable side of an outer join.
1) The predicate needs to be bound by tupleIds.
2) The predicate is not on-clause.
3) The predicate evaluates to false when all its referenced tuples are NULL.

Therefore, 'b.upper_val is NULL' cannot be propagated to inline view but
‘b.len = 0’ can be propagated to inline view.

Tests:
* Add plan tests in inline-view.test
* One baseline plan in inline-view.test, one in nested-collections.test
and two in predicate-propagation.test had to be updated
* Ran the full set of verifications in Impala Public Jenkins

Change-Id: I6c23a45aeb5dd1aa06a95c9aa8628ecbe37ef2c1
Reviewed-on: http://gerrit.cloudera.org:8080/15047
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
(cherry picked from commit 9cb6dabe10da0aa29d61b6bba0f82ec3cefc4e0d)


> Bound predicates optimization doesn't work for InlineView
> ---------------------------------------------------------
>
>                 Key: IMPALA-8361
>                 URL: https://issues.apache.org/jira/browse/IMPALA-8361
>             Project: IMPALA
>          Issue Type: Improvement
>          Components: Frontend
>    Affects Versions: Impala 3.0, Impala 2.12.0, Impala 3.1.0, Impala 3.2.0, Impala 3.3.0
>            Reporter: Fu Lili
>            Assignee: hexianqing
>            Priority: Major
>             Fix For: Impala 3.4.0
>
>         Attachments: image-2019-03-26-23-11-49-483.png, image-2019-03-26-23-12-05-276.png
>
>
> Tables for test:
>  
> {code:java}
> CREATE TABLE test_a (
> id STRING,
> val STRING
> );
> CREATE TABLE test_b (
> id STRING,
> val STRING
> );
> {code}
>  
>  
> Bound predicates optimization (implement in Analyzer::getBoundPredicates) works for this sql:
>  
> {code:java}
> EXPLAIN
> SELECT count(*) FROM test_a a
> LEFT JOIN
> (SELECT * FROM test_b) b
> ON a.id=b.id
> WHERE upper(b.val)='123';{code}
> !image-2019-03-26-23-11-49-483.png!
>  
> But does't work for this one:
>  
> {code:java}
> EXPLAIN
> SELECT count(*) FROM test_a a
> LEFT JOIN
> (SELECT *, upper(val) AS upper_val FROM test_b) b
> ON a.id=b.id
> WHERE upper_val='123';
> {code}
> !image-2019-03-26-23-12-05-276.png!
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org