-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LATERAL JOIN: Checkpoint 2: Optimizer Implementation
- Loading branch information
Showing
8 changed files
with
275 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# coding=utf-8 | ||
# Copyright 2018-2020 EVA | ||
# | ||
# Licensed 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. | ||
|
||
|
||
"""Abstract class for all the join planners | ||
""" | ||
from src.expression.abstract_expression import AbstractExpression | ||
from src.planner.abstract_plan import AbstractPlan | ||
from src.parser.types import JoinType | ||
|
||
from src.planner.types import PlanNodeType | ||
|
||
|
||
class AbstractJoin(AbstractPlan): | ||
"""Abstract class for all the join based planners | ||
Arguments: | ||
join_type: JoinType | ||
type of join, INNER, OUTER , LATERAL etc | ||
join_predicate: AbstractExpression | ||
An expression used for joining | ||
""" | ||
|
||
def __init__(self, | ||
node_type: PlanNodeType, | ||
join_type: JoinType, | ||
join_predicate: AbstractExpression): | ||
super().__init__(node_type) | ||
self._join_type = join_type | ||
self._join_predicate = join_predicate | ||
|
||
@property | ||
def join_type(self) -> AbstractExpression: | ||
return self._join_type | ||
|
||
@property | ||
def join_predicate(self) -> AbstractExpression: | ||
return self._join_predicate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# coding=utf-8 | ||
# Copyright 2018-2020 EVA | ||
# | ||
# Licensed 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. | ||
|
||
from src.planner.types import PlanNodeType | ||
from src.planner.abstract_plan import AbstractPlan | ||
from src.expression.function_expression import FunctionExpression | ||
|
||
|
||
class FunctionScan(AbstractPlan): | ||
""" | ||
This plan used to store metadata to perform function table scan. | ||
Arguments: | ||
""" | ||
|
||
def __init__(self, func_expr: FunctionExpression): | ||
self._func_expr = func_expr | ||
super().__init__(PlanNodeType.FUNCTION_SCAN) | ||
|
||
@property | ||
def func_expr(self): | ||
return self._func_expr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# coding=utf-8 | ||
# Copyright 2018-2020 EVA | ||
# | ||
# Licensed 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. | ||
|
||
from src.planner.types import PlanNodeType | ||
from src.planner.abstract_join_plan import AbstractJoin | ||
from src.expression.abstract_expression import AbstractExpression | ||
from src.parser.types import JoinType | ||
|
||
|
||
class NestedLoopJoin(AbstractJoin): | ||
""" | ||
This plan is used for storing information required for nested loop join. | ||
Arguments: | ||
join_type: JoinType | ||
join_predicate: AbstractExpression | ||
""" | ||
|
||
def __init__(self, | ||
join_type: JoinType, | ||
join_predicate: AbstractExpression): | ||
super().__init__(PlanNodeType.JOIN, join_type, join_predicate) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters