| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| |
| [default initial_logical_plan] |
| |
| SELECT a.z |
| FROM a JOIN b ON a.w = b.w |
| JOIN c ON a.x = c.x |
| JOIN d ON a.y = d.y; |
| -- |
| TopLevelPlan |
| +-plan=Project |
| | +-input=Filter |
| | | +-input=MultiwayCartesianJoin |
| | | | +-Filter |
| | | | | +-input=MultiwayCartesianJoin |
| | | | | | +-Filter |
| | | | | | | +-input=MultiwayCartesianJoin |
| | | | | | | | +-TableReference[relation_name=a] |
| | | | | | | | | +-AttributeReference[id=0,name=w,relation=a,type=Int] |
| | | | | | | | | +-AttributeReference[id=1,name=x,relation=a,type=Int] |
| | | | | | | | | +-AttributeReference[id=2,name=y,relation=a,type=Int] |
| | | | | | | | | +-AttributeReference[id=3,name=z,relation=a,type=Int] |
| | | | | | | | +-TableReference[relation_name=b] |
| | | | | | | | +-AttributeReference[id=4,name=w,relation=b,type=Int] |
| | | | | | | | +-AttributeReference[id=5,name=x,relation=b,type=Int] |
| | | | | | | +-filter_predicate=Equal |
| | | | | | | +-AttributeReference[id=0,name=w,relation=a,type=Int] |
| | | | | | | +-AttributeReference[id=4,name=w,relation=b,type=Int] |
| | | | | | +-TableReference[relation_name=c] |
| | | | | | +-AttributeReference[id=6,name=x,relation=c,type=Int] |
| | | | | | +-AttributeReference[id=7,name=y,relation=c,type=Int] |
| | | | | +-filter_predicate=Equal |
| | | | | +-AttributeReference[id=1,name=x,relation=a,type=Int] |
| | | | | +-AttributeReference[id=6,name=x,relation=c,type=Int] |
| | | | +-TableReference[relation_name=d] |
| | | | +-AttributeReference[id=8,name=y,relation=d,type=Int] |
| | | | +-AttributeReference[id=9,name=z,relation=d,type=Int] |
| | | +-filter_predicate=Equal |
| | | +-AttributeReference[id=2,name=y,relation=a,type=Int] |
| | | +-AttributeReference[id=8,name=y,relation=d,type=Int] |
| | +-project_list= |
| | +-AttributeReference[id=3,name=z,relation=a,type=Int] |
| +-output_attributes= |
| +-AttributeReference[id=3,name=z,relation=a,type=Int] |
| == |
| |
| SELECT a.z |
| FROM a JOIN b ON (a.w = b.w OR a.x > b.x) |
| JOIN c ON (a.x = c.x OR a.y > c.y) |
| JOIN d ON (a.y = d.y OR a.z > d.z); |
| -- |
| TopLevelPlan |
| +-plan=Project |
| | +-input=Filter |
| | | +-input=MultiwayCartesianJoin |
| | | | +-Filter |
| | | | | +-input=MultiwayCartesianJoin |
| | | | | | +-Filter |
| | | | | | | +-input=MultiwayCartesianJoin |
| | | | | | | | +-TableReference[relation_name=a] |
| | | | | | | | | +-AttributeReference[id=0,name=w,relation=a,type=Int] |
| | | | | | | | | +-AttributeReference[id=1,name=x,relation=a,type=Int] |
| | | | | | | | | +-AttributeReference[id=2,name=y,relation=a,type=Int] |
| | | | | | | | | +-AttributeReference[id=3,name=z,relation=a,type=Int] |
| | | | | | | | +-TableReference[relation_name=b] |
| | | | | | | | +-AttributeReference[id=4,name=w,relation=b,type=Int] |
| | | | | | | | +-AttributeReference[id=5,name=x,relation=b,type=Int] |
| | | | | | | +-filter_predicate=Or |
| | | | | | | +-Equal |
| | | | | | | | +-AttributeReference[id=0,name=w,relation=a,type=Int] |
| | | | | | | | +-AttributeReference[id=4,name=w,relation=b,type=Int] |
| | | | | | | +-Greater |
| | | | | | | +-AttributeReference[id=1,name=x,relation=a,type=Int] |
| | | | | | | +-AttributeReference[id=5,name=x,relation=b,type=Int] |
| | | | | | +-TableReference[relation_name=c] |
| | | | | | +-AttributeReference[id=6,name=x,relation=c,type=Int] |
| | | | | | +-AttributeReference[id=7,name=y,relation=c,type=Int] |
| | | | | +-filter_predicate=Or |
| | | | | +-Equal |
| | | | | | +-AttributeReference[id=1,name=x,relation=a,type=Int] |
| | | | | | +-AttributeReference[id=6,name=x,relation=c,type=Int] |
| | | | | +-Greater |
| | | | | +-AttributeReference[id=2,name=y,relation=a,type=Int] |
| | | | | +-AttributeReference[id=7,name=y,relation=c,type=Int] |
| | | | +-TableReference[relation_name=d] |
| | | | +-AttributeReference[id=8,name=y,relation=d,type=Int] |
| | | | +-AttributeReference[id=9,name=z,relation=d,type=Int] |
| | | +-filter_predicate=Or |
| | | +-Equal |
| | | | +-AttributeReference[id=2,name=y,relation=a,type=Int] |
| | | | +-AttributeReference[id=8,name=y,relation=d,type=Int] |
| | | +-Greater |
| | | +-AttributeReference[id=3,name=z,relation=a,type=Int] |
| | | +-AttributeReference[id=9,name=z,relation=d,type=Int] |
| | +-project_list= |
| | +-AttributeReference[id=3,name=z,relation=a,type=Int] |
| +-output_attributes= |
| +-AttributeReference[id=3,name=z,relation=a,type=Int] |
| == |
| |
| SELECT a1.z |
| FROM a AS a1 JOIN b AS b1 ON a1.w = b1.w |
| JOIN c AS c1 ON a1.x = c1.x |
| JOIN d AS d1 ON a1.y = d1.y; |
| WHERE a1.x = b1.x |
| AND a1.y = c1.y |
| AND a1.z = d1.z; |
| -- |
| TopLevelPlan |
| +-plan=Project |
| | +-input=Filter |
| | | +-input=MultiwayCartesianJoin |
| | | | +-Filter |
| | | | | +-input=MultiwayCartesianJoin |
| | | | | | +-Filter |
| | | | | | | +-input=MultiwayCartesianJoin |
| | | | | | | | +-TableReference[relation_name=a,relation_alias=a1] |
| | | | | | | | | +-AttributeReference[id=0,name=w,relation=a1,type=Int] |
| | | | | | | | | +-AttributeReference[id=1,name=x,relation=a1,type=Int] |
| | | | | | | | | +-AttributeReference[id=2,name=y,relation=a1,type=Int] |
| | | | | | | | | +-AttributeReference[id=3,name=z,relation=a1,type=Int] |
| | | | | | | | +-TableReference[relation_name=b,relation_alias=b1] |
| | | | | | | | +-AttributeReference[id=4,name=w,relation=b1,type=Int] |
| | | | | | | | +-AttributeReference[id=5,name=x,relation=b1,type=Int] |
| | | | | | | +-filter_predicate=Equal |
| | | | | | | +-AttributeReference[id=0,name=w,relation=a1,type=Int] |
| | | | | | | +-AttributeReference[id=4,name=w,relation=b1,type=Int] |
| | | | | | +-TableReference[relation_name=c,relation_alias=c1] |
| | | | | | +-AttributeReference[id=6,name=x,relation=c1,type=Int] |
| | | | | | +-AttributeReference[id=7,name=y,relation=c1,type=Int] |
| | | | | +-filter_predicate=Equal |
| | | | | +-AttributeReference[id=1,name=x,relation=a1,type=Int] |
| | | | | +-AttributeReference[id=6,name=x,relation=c1,type=Int] |
| | | | +-TableReference[relation_name=d,relation_alias=d1] |
| | | | +-AttributeReference[id=8,name=y,relation=d1,type=Int] |
| | | | +-AttributeReference[id=9,name=z,relation=d1,type=Int] |
| | | +-filter_predicate=Equal |
| | | +-AttributeReference[id=2,name=y,relation=a1,type=Int] |
| | | +-AttributeReference[id=8,name=y,relation=d1,type=Int] |
| | +-project_list= |
| | +-AttributeReference[id=3,name=z,relation=a1,type=Int] |
| +-output_attributes= |
| +-AttributeReference[id=3,name=z,relation=a1,type=Int] |
| == |
| |
| |
| # Outer joins |
| SELECT * |
| FROM b LEFT JOIN c ON (b.x = c.x AND c.x > 10); |
| -- |
| TopLevelPlan |
| +-plan=Project |
| | +-input=HashLeftOuterJoin |
| | | +-left=TableReference[relation_name=b] |
| | | | +-AttributeReference[id=0,name=w,relation=b,type=Int] |
| | | | +-AttributeReference[id=1,name=x,relation=b,type=Int] |
| | | +-right=TableReference[relation_name=c] |
| | | | +-AttributeReference[id=2,name=x,relation=c,type=Int] |
| | | | +-AttributeReference[id=3,name=y,relation=c,type=Int] |
| | | +-residual_predicate=And |
| | | | +-Equal |
| | | | | +-AttributeReference[id=1,name=x,relation=b,type=Int] |
| | | | | +-AttributeReference[id=2,name=x,relation=c,type=Int] |
| | | | +-Greater |
| | | | +-AttributeReference[id=2,name=x,relation=c,type=Int] |
| | | | +-Literal[value=10,type=Int] |
| | | +-left_join_attributes= |
| | | | +-[] |
| | | +-right_join_attributes= |
| | | +-[] |
| | +-project_list= |
| | +-AttributeReference[id=0,name=w,relation=b,type=Int] |
| | +-AttributeReference[id=1,name=x,relation=b,type=Int] |
| | +-AttributeReference[id=2,name=x,relation=c,type=Int NULL] |
| | +-AttributeReference[id=3,name=y,relation=c,type=Int NULL] |
| +-output_attributes= |
| +-AttributeReference[id=0,name=w,relation=b,type=Int] |
| +-AttributeReference[id=1,name=x,relation=b,type=Int] |
| +-AttributeReference[id=2,name=x,relation=c,type=Int NULL] |
| +-AttributeReference[id=3,name=y,relation=c,type=Int NULL] |
| == |
| |
| SELECT a.w, b.x, c.y, a.w + b.x + c.y |
| FROM a LEFT JOIN b ON a.w = b.w RIGHT JOIN c ON b.x = c.x; |
| -- |
| TopLevelPlan |
| +-plan=Project |
| | +-input=HashLeftOuterJoin |
| | | +-left=TableReference[relation_name=c] |
| | | | +-AttributeReference[id=6,name=x,relation=c,type=Int] |
| | | | +-AttributeReference[id=7,name=y,relation=c,type=Int] |
| | | +-right=HashLeftOuterJoin |
| | | | +-left=TableReference[relation_name=a] |
| | | | | +-AttributeReference[id=0,name=w,relation=a,type=Int] |
| | | | | +-AttributeReference[id=1,name=x,relation=a,type=Int] |
| | | | | +-AttributeReference[id=2,name=y,relation=a,type=Int] |
| | | | | +-AttributeReference[id=3,name=z,relation=a,type=Int] |
| | | | +-right=TableReference[relation_name=b] |
| | | | | +-AttributeReference[id=4,name=w,relation=b,type=Int] |
| | | | | +-AttributeReference[id=5,name=x,relation=b,type=Int] |
| | | | +-residual_predicate=Equal |
| | | | | +-AttributeReference[id=0,name=w,relation=a,type=Int] |
| | | | | +-AttributeReference[id=4,name=w,relation=b,type=Int] |
| | | | +-left_join_attributes= |
| | | | | +-[] |
| | | | +-right_join_attributes= |
| | | | +-[] |
| | | +-residual_predicate=Equal |
| | | | +-AttributeReference[id=5,name=x,relation=b,type=Int NULL] |
| | | | +-AttributeReference[id=6,name=x,relation=c,type=Int] |
| | | +-left_join_attributes= |
| | | | +-[] |
| | | +-right_join_attributes= |
| | | +-[] |
| | +-project_list= |
| | +-AttributeReference[id=0,name=w,relation=a,type=Int NULL] |
| | +-AttributeReference[id=5,name=x,relation=b,type=Int NULL] |
| | +-AttributeReference[id=7,name=y,relation=c,type=Int] |
| | +-Alias[id=8,name=,alias=((a.w+b.x)+c.y),relation=,type=Int NULL] |
| | +-Add |
| | +-Add |
| | | +-AttributeReference[id=0,name=w,relation=a,type=Int NULL] |
| | | +-AttributeReference[id=5,name=x,relation=b,type=Int NULL] |
| | +-AttributeReference[id=7,name=y,relation=c,type=Int] |
| +-output_attributes= |
| +-AttributeReference[id=0,name=w,relation=a,type=Int NULL] |
| +-AttributeReference[id=5,name=x,relation=b,type=Int NULL] |
| +-AttributeReference[id=7,name=y,relation=c,type=Int] |
| +-AttributeReference[id=8,name=,alias=((a.w+b.x)+c.y),relation=,type=Int NULL] |
| == |
| |
| SELECT a.w, b.x, c.y, a.w + b.x + c.y |
| FROM a LEFT JOIN (b RIGHT JOIN c ON b.x = c.x) ON a.w = b.w; |
| -- |
| TopLevelPlan |
| +-plan=Project |
| | +-input=HashLeftOuterJoin |
| | | +-left=TableReference[relation_name=a] |
| | | | +-AttributeReference[id=0,name=w,relation=a,type=Int] |
| | | | +-AttributeReference[id=1,name=x,relation=a,type=Int] |
| | | | +-AttributeReference[id=2,name=y,relation=a,type=Int] |
| | | | +-AttributeReference[id=3,name=z,relation=a,type=Int] |
| | | +-right=HashLeftOuterJoin |
| | | | +-left=TableReference[relation_name=c] |
| | | | | +-AttributeReference[id=6,name=x,relation=c,type=Int] |
| | | | | +-AttributeReference[id=7,name=y,relation=c,type=Int] |
| | | | +-right=TableReference[relation_name=b] |
| | | | | +-AttributeReference[id=4,name=w,relation=b,type=Int] |
| | | | | +-AttributeReference[id=5,name=x,relation=b,type=Int] |
| | | | +-residual_predicate=Equal |
| | | | | +-AttributeReference[id=5,name=x,relation=b,type=Int] |
| | | | | +-AttributeReference[id=6,name=x,relation=c,type=Int] |
| | | | +-left_join_attributes= |
| | | | | +-[] |
| | | | +-right_join_attributes= |
| | | | +-[] |
| | | +-residual_predicate=Equal |
| | | | +-AttributeReference[id=0,name=w,relation=a,type=Int] |
| | | | +-AttributeReference[id=4,name=w,relation=b,type=Int NULL] |
| | | +-left_join_attributes= |
| | | | +-[] |
| | | +-right_join_attributes= |
| | | +-[] |
| | +-project_list= |
| | +-AttributeReference[id=0,name=w,relation=a,type=Int] |
| | +-AttributeReference[id=5,name=x,relation=b,type=Int NULL] |
| | +-AttributeReference[id=7,name=y,relation=c,type=Int NULL] |
| | +-Alias[id=8,name=,alias=((a.w+b.x)+c.y),relation=,type=Int NULL] |
| | +-Add |
| | +-Add |
| | | +-AttributeReference[id=0,name=w,relation=a,type=Int] |
| | | +-AttributeReference[id=5,name=x,relation=b,type=Int NULL] |
| | +-AttributeReference[id=7,name=y,relation=c,type=Int NULL] |
| +-output_attributes= |
| +-AttributeReference[id=0,name=w,relation=a,type=Int] |
| +-AttributeReference[id=5,name=x,relation=b,type=Int NULL] |
| +-AttributeReference[id=7,name=y,relation=c,type=Int NULL] |
| +-AttributeReference[id=8,name=,alias=((a.w+b.x)+c.y),relation=,type=Int NULL] |
| == |
| |
| SELECT * |
| FROM b FULL JOIN c ON b.x = c.x; |
| -- |
| ERROR: Full outer join is not supported yet (2 : 13) |
| FROM b FULL JOIN c ON b.x = c.x; |
| ^ |