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

georgia-tech-db / eva / #850

08 Nov 2023 08:36PM UTC coverage: 0.0% (-77.0%) from 76.982%
#850

push

circleci

americast
fix metrics logic

0 of 1 new or added line in 1 file covered. (0.0%)

9789 existing lines in 252 files now uncovered.

0 of 12428 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/executor/abstract_executor.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.
UNCOV
15
from abc import ABC, abstractmethod
×
UNCOV
16
from collections import deque
×
UNCOV
17
from typing import TYPE_CHECKING, Any, Generator, Iterable, List, TypeVar
×
18

19
if TYPE_CHECKING:
20
    from evadb.catalog.catalog_manager import CatalogManager
UNCOV
21
from evadb.database import EvaDBDatabase
×
UNCOV
22
from evadb.models.storage.batch import Batch
×
UNCOV
23
from evadb.plan_nodes.abstract_plan import AbstractPlan
×
24

UNCOV
25
AbstractExecutor = TypeVar("AbstractExecutor")
×
26

27

UNCOV
28
class AbstractExecutor(ABC):
×
29
    """
30
    An abstract class for the executor engine
31
    Arguments:
32
        node (AbstractPlan): Plan node corresponding to this executor
33
    """
34

UNCOV
35
    def __init__(self, db: EvaDBDatabase, node: AbstractPlan):
×
UNCOV
36
        self._db = db
×
UNCOV
37
        self._node = node
×
UNCOV
38
        self._children = []
×
39

40
    # @lru_cache(maxsize=None)
UNCOV
41
    def catalog(self) -> "CatalogManager":
×
42
        """The object is intentionally generated on demand to prevent serialization issues. Having a SQLAlchemy object as a member variable can cause problems with multiprocessing. See get_catalog_instance()"""
UNCOV
43
        return self._db.catalog() if self._db else None
×
44

UNCOV
45
    def append_child(self, child: AbstractExecutor):
×
46
        """
47
        appends a child executor node
48

49
        Arguments:
50
            child {AbstractExecutor} -- child node
51
        """
UNCOV
52
        self._children.append(child)
×
53

UNCOV
54
    @property
×
UNCOV
55
    def children(self) -> List[AbstractExecutor]:
×
56
        """
57
        Returns the list of child executor
58
        Returns:
59
            [] -- list of children
60
        """
UNCOV
61
        return self._children
×
62

UNCOV
63
    @children.setter
×
UNCOV
64
    def children(self, children):
×
65
        self._children = children
×
66

UNCOV
67
    @property
×
UNCOV
68
    def node(self) -> AbstractPlan:
×
UNCOV
69
        return self._node
×
70

UNCOV
71
    @property
×
UNCOV
72
    def db(self) -> EvaDBDatabase:
×
UNCOV
73
        return self._db
×
74

UNCOV
75
    @abstractmethod
×
UNCOV
76
    def exec(self, *args, **kwargs) -> Iterable[Batch]:
×
77
        """
78
        This method is implemented by every executor.
79
        Contains logic for that executor;
80
        For retrieval based executor : It fetches frame batches from
81
        child nodes and emits it to parent node.
82
        """
83

UNCOV
84
    def __call__(self, *args, **kwargs) -> Generator[Batch, None, None]:
×
85
        yield from self.exec(*args, **kwargs)
×
86

UNCOV
87
    def bfs(self):
×
88
        """Returns a generator which visits all nodes in execution tree in
89
        breadth-first search (BFS) traversal order.
90

91
        Returns:
92
            the generator object.
93
        """
94
        queue = deque([self])
×
95
        while queue:
×
96
            node = queue.popleft()
×
97
            yield node
×
98
            for child in node.children:
×
99
                queue.append(child)
×
100

UNCOV
101
    def find_all(self, execution_type: Any):
×
102
        """Returns a generator which visits all the nodes in execution tree and yields one that matches the passed `execution_type`.
103

104
        Args:
105
            execution_type (Any): execution type to match with
106

107
        Returns:
108
            the generator object.
109
        """
110

111
        for node in self.bfs():
×
112
            if isinstance(node, execution_type):
×
113
                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

© 2026 Coveralls, Inc