• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

georgia-tech-db / eva / #758

04 Sep 2023 08:37PM UTC coverage: 0.0% (-78.3%) from 78.333%
#758

push

circle-ci

hershd23
Increased underline length in at line 75 in text_summarization.rst
	modified:   docs/source/benchmarks/text_summarization.rst

0 of 11303 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/evadb/plan_nodes/abstract_plan.py
1
# coding=utf-8
2
# Copyright 2018-2023 EvaDB
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
#     http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
from abc import ABC, abstractmethod
×
16
from collections import deque
×
17
from typing import Any, List
×
18

19
from evadb.plan_nodes.types import PlanOprType
×
20

21

22
class AbstractPlan(ABC):
×
23
    def __init__(self, opr_type):
×
24
        self._children = []
×
25
        self._parent = None
×
26
        self._opr_type = opr_type
×
27

28
    def append_child(self, child):
×
29
        """append node to children list
30

31
        Arguments:
32
            child {AbstractPlan} -- input child node
33
        """
34
        self._children.append(child)
×
35

36
    @property
×
37
    def parent(self):
×
38
        """Returns the parent of current node
39

40
        Returns:
41
            AbstractPlan -- parent node
42
        """
43
        return self._parent
×
44

45
    @parent.setter
×
46
    def parent(self, node: "AbstractPlan"):
×
47
        """sets parent of current node
48

49
        Arguments:
50
            node {AbstractPlan} -- parent node
51
        """
52
        # remove if we don't allow setter function
53
        # parent can be constructor only job
54
        self._parent = node
×
55

56
    @property
×
57
    def children(self) -> List["AbstractPlan"]:
×
58
        return self._children
×
59

60
    @property
×
61
    def opr_type(self) -> PlanOprType:
×
62
        """
63
        Property used for returning the node type of Plan.
64

65
        Returns:
66
            PlanOprType: The node type corresponding to the plan
67
        """
68
        return self._opr_type
×
69

70
    def clear_children(self):
×
71
        self.children.clear()
×
72

73
    def is_logical(self):
×
74
        return False
×
75

76
    @abstractmethod
×
77
    def __hash__(self) -> int:
×
78
        return hash(self.opr_type)
×
79

80
    @abstractmethod
×
81
    def __str__(self) -> str:
×
82
        return "AbstractPlan"
×
83

84
    def __copy__(self):
×
85
        # deepcopy the children
86
        cls = self.__class__
×
87
        result = cls.__new__(cls)
×
88
        for k, v in self.__dict__.items():
×
89
            if k == "_children":
×
90
                setattr(result, k, [])
×
91
            else:
92
                setattr(result, k, v)
×
93
        return result
×
94

95
    def walk(self, bfs=True):
×
96
        """
97
        Returns a generator which visits all nodes in physical plan tree.
98
        """
99
        if bfs:
×
100
            yield from self.bfs()
×
101
        else:
102
            yield from self.dfs()
×
103

104
    def bfs(self):
×
105
        queue = deque([self])
×
106
        while queue:
×
107
            node = queue.popleft()
×
108
            yield node
×
109
            for child in node.children:
×
110
                queue.append(child)
×
111

112
    def dfs(self):
×
113
        yield self
×
114
        for child in self.children:
×
115
            yield from child.dfs()
×
116

117
    def find_all(self, plan_type: Any):
×
118
        """Returns a generator which visits all the nodes in plan tree and yields one
119
        that matches the passed `expression_type`.
120

121
        Args:
122
            plan_type (Any): plan type to match with
123

124
        Returns:
125
            the generator object.
126
        """
127

128
        for node in self.bfs():
×
129
            if isinstance(node, plan_type):
×
130
                yield node
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc