From 3ddd92c3633d2b825d64c794b771a4458c0b61b4 Mon Sep 17 00:00:00 2001 From: Aayush Acharya Date: Sun, 25 Feb 2024 16:16:04 +0545 Subject: [PATCH] refactor: used `create_plan` across codebase, closes #1145 --- evadb/optimizer/rules/rules.py | 5 +- evadb/plan_nodes/create_from_select_plan.py | 71 --------------------- 2 files changed, 1 insertion(+), 75 deletions(-) delete mode 100644 evadb/plan_nodes/create_from_select_plan.py diff --git a/evadb/optimizer/rules/rules.py b/evadb/optimizer/rules/rules.py index cb9ff32742..6475b5fb8e 100644 --- a/evadb/optimizer/rules/rules.py +++ b/evadb/optimizer/rules/rules.py @@ -40,7 +40,6 @@ from evadb.optimizer.rules.rules_base import Promise, Rule, RuleType from evadb.parser.types import JoinType, ParserOrderBySortType from evadb.plan_nodes.apply_and_merge_plan import ApplyAndMergePlan -from evadb.plan_nodes.create_from_select_plan import CreateFromSelectPlan from evadb.plan_nodes.exchange_plan import ExchangePlan from evadb.plan_nodes.explain_plan import ExplainPlan from evadb.plan_nodes.hash_join_build_plan import HashJoinBuildPlan @@ -735,9 +734,7 @@ def check(self, before: Operator, context: OptimizerContext): return True def apply(self, before: LogicalCreate, context: OptimizerContext): - after = CreateFromSelectPlan( - before.video, before.column_list, before.if_not_exists - ) + after = CreatePlan(before.video, before.column_list, before.if_not_exists) for child in before.children: after.append_child(child) yield after diff --git a/evadb/plan_nodes/create_from_select_plan.py b/evadb/plan_nodes/create_from_select_plan.py deleted file mode 100644 index de0a1bc26a..0000000000 --- a/evadb/plan_nodes/create_from_select_plan.py +++ /dev/null @@ -1,71 +0,0 @@ -# coding=utf-8 -# Copyright 2018-2023 EvaDB -# -# 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 typing import List - -from evadb.parser.create_statement import ColumnDefinition -from evadb.parser.table_ref import TableInfo -from evadb.plan_nodes.abstract_plan import AbstractPlan -from evadb.plan_nodes.types import PlanOprType - - -class CreateFromSelectPlan(AbstractPlan): - """ - This plan is used for storing information required for creating - a table from select query. - Arguments: - table_info {TableInfo} -- table info for view to be created in storage - col_list{List[ColumnDefinition]} -- column names in the view - if_not_exists {bool} -- Whether to override if there is existing view - """ - - def __init__( - self, - table_info: TableInfo, - column_list: List[ColumnDefinition], - if_not_exists: bool = False, - ): - super().__init__(PlanOprType.CREATE) - self._table_info = table_info - self._column_list = column_list - self._if_not_exists = if_not_exists - - @property - def table_info(self): - return self._table_info - - @property - def if_not_exists(self): - return self._if_not_exists - - @property - def column_list(self): - return self._column_list - - def __str__(self): - return "CreateFromSelectPlan(table_info={}, \ - column_lists={}, \ - if_not_exists={})".format( - self._table_info, self._column_list, self._if_not_exists - ) - - def __hash__(self) -> int: - return hash( - ( - super().__hash__(), - self.table_info, - self.if_not_exists, - tuple(self.column_list), - ) - )