You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This rule is to unfold flat derived table containing only simple projections.
For example:
SELECT*FROM (SELECT c0, c1 +1as cc FROM t1) x1 WHERE f(cc+1) >0
could be unfolded and translate to equivalent SQL like below:
SELECT c0, c1 +1as cc FROM t1 WHERE f(c1 +1+1) >0
The benefits are not only further optimizations like expression simplify, but also more tables involved in join reorder.
In some scenarios, users specify bushy join via derived table:
SELECT1FROM t1 JOIN t2 JOIN (SELECT*FROM t3 JOIN t4)
With this rule applied, we could reorder 4 tables instead of 3. Althrough SQL does not allow such syntax:
SELECT1FROM t1 JOIN t2 JOIN (t3 JOIN t4)
More advanced unfolding is left for future improvements, e.g. certain patterns of aggr+join involved in derived table could also be unfolded.
The text was updated successfully, but these errors were encountered:
There is limitation on outer query to apply this rule. Suppose we have SQL:
SELECTtt.c1, tt.c2FROM t1 LEFT JOIN (SELECT1as c1, c2 FROM t2 JOIN t3) tt
Replacing topmost tt.c1 expression with 1 as c1 is absolutely wrong.
This is because the semantics of LEFT JOIN can change output values in right table to null.
That means, if any expression in derived table output can not ensure such behavior, we have to double check the outer query semantics, to ensure derived table is not at either sides of FULL JOIN or right side of LEFT JOIN.
This rule is to unfold flat derived table containing only simple projections.
For example:
could be unfolded and translate to equivalent SQL like below:
The benefits are not only further optimizations like expression simplify, but also more tables involved in join reorder.
In some scenarios, users specify bushy join via derived table:
With this rule applied, we could reorder 4 tables instead of 3. Althrough SQL does not allow such syntax:
More advanced unfolding is left for future improvements, e.g. certain patterns of aggr+join involved in derived table could also be unfolded.
The text was updated successfully, but these errors were encountered: