Fang-Yu Rao has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/21688 )

Change subject: IMPALA-13262: Do not always migrate inferred predicates into 
inline view
......................................................................


Patch Set 2:

(1 comment)

I found a bug in patch set 2 pointed out by Riza. I will try to fix this in the 
next patch.

http://gerrit.cloudera.org:8080/#/c/21688/2/testdata/workloads/functional-query/queries/QueryTest/inline-view.test
File testdata/workloads/functional-query/queries/QueryTest/inline-view.test:

http://gerrit.cloudera.org:8080/#/c/21688/2/testdata/workloads/functional-query/queries/QueryTest/inline-view.test@597
PS2, Line 597: # IMPALA-13262: Do not migrate an inferred predicate into an 
inline view if both sides of
             : # the inferred predicate reference the same base table.
> Please add one more test:
Thanks Riza!

I think this query should return the following as you mentioned but the current 
patch (patch set 2) could not handle this correctly.

 +------+------+---------+------+
 | year | id   | int_col | rn   |
 +------+------+---------+------+
 | 2009 | 9    | 9       | 7281 |
 | 2009 | 9    | 9       | 7282 |
 | 2009 | 8    | 8       | 7283 |
 | 2009 | 8    | 8       | 7284 |
 | 2009 | 7    | 7       | 7285 |
 | 2009 | 7    | 7       | 7286 |
 | 2009 | 6    | 6       | 7287 |
 | 2009 | 6    | 6       | 7288 |
 | 2009 | 5    | 5       | 7289 |
 | 2009 | 5    | 5       | 7290 |
 | 2009 | 4    | 4       | 7291 |
 | 2009 | 4    | 4       | 7292 |
 | 2009 | 3    | 3       | 7293 |
 | 2009 | 3    | 3       | 7294 |
 | 2009 | 2    | 2       | 7295 |
 | 2009 | 2    | 2       | 7296 |
 | 2009 | 1    | 1       | 7297 |
 | 2009 | 1    | 1       | 7298 |
 | 2009 | 0    | 0       | 7299 |
 | 2009 | 0    | 0       | 7300 |


I think this concrete test case also answers my question at 
https://gerrit.cloudera.org/c/21688/1/fe/src/main/java/org/apache/impala/planner/SingleNodePlanner.java#1567.

In this specific test case, when we try to migrate the inferred binary 
predicate 'iv.id = iv.int_col' into the inline view 'allt', 'leftParent' (of 
'iv.id') and 'rightParent' (of 'iv.int_col') correspond to the same inline view 
'allt' that could not resolve to a base table and thus such an inferred 
predicate would not be removed by patch set 2, resulting in this inferred 
predicate being pushed to the scan node of the base table 'functional.alltypes'.

I think the fix could very likely be using ''leftParent.equals(rightParent)' 
which could deal with the case when both parents resolve to the same non-base 
table, e.g., an inline view.

I will revise patch set 2 accordingly.



--
To view, visit http://gerrit.cloudera.org:8080/21688
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6e2632b3b1a140ae0104ceba4e2f474ac1bbcda1
Gerrit-Change-Number: 21688
Gerrit-PatchSet: 2
Gerrit-Owner: Fang-Yu Rao <[email protected]>
Gerrit-Reviewer: Aman Sinha <[email protected]>
Gerrit-Reviewer: Fang-Yu Rao <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>
Gerrit-Reviewer: Quanlong Huang <[email protected]>
Gerrit-Reviewer: Riza Suminto <[email protected]>
Gerrit-Comment-Date: Wed, 21 Aug 2024 00:09:01 +0000
Gerrit-HasComments: Yes

Reply via email to