Given this query:
CREATE TABLE X(x INT);
CREATE TABLE Y(x INT, y INT);
CREATE VIEW V AS SELECT X.x, Y.y FROM X JOIN Y ON X.x = Y.x WHERE Y.y = 23
there is a rewrite rule which pulls up the Y.y = 23 predicate, optimizing this:
LogicalProject(x=[$0], y=[$2]), id = 65
LogicalFilter(condition=[=($2, 23)]), id = 63
LogicalJoin(condition=[=($0, $1)], joinType=[inner]), id = 62
LogicalTableScan(table=[[schema, x]]), id = 59
LogicalTableScan(table=[[schema, y]]), id = 61
into this:
LogicalProject(x=[$0], y=[CAST(23):INTEGER]), id = 136
LogicalJoin(condition=[=($0, $1)], joinType=[inner]), id = 134
LogicalTableScan(table=[[schema, x]]), id = 59
LogicalFilter(condition=[=($1, 23)]), id = 132
LogicalTableScan(table=[[schema, y]]), id = 61
But is there a rule that would pull up the predicate from the following query?
CREATE VIEW V AS SELECT X.x, Y.y FROM X JOIN Y ON X.x = Y.x AND Y.y = 23
Thank you,
Mihai