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

georgia-tech-db / eva / a4c010ba-78be-4818-8e6f-1da08c6af280

31 Aug 2023 11:59PM UTC coverage: 70.992% (-10.6%) from 81.552%
a4c010ba-78be-4818-8e6f-1da08c6af280

push

circle-ci

web-flow
Merge branch 'staging' into evadb_staging

54 of 54 new or added lines in 3 files covered. (100.0%)

8020 of 11297 relevant lines covered (70.99%)

0.71 hits per line

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

86.67
/evadb/optimizer/group_expression.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 typing import List
1✔
16

17
from evadb.constants import UNDEFINED_GROUP_ID
1✔
18
from evadb.optimizer.operators import Operator
1✔
19
from evadb.optimizer.rules.rules_base import RuleType
1✔
20

21

22
class GroupExpression:
1✔
23
    def __init__(
1✔
24
        self,
25
        opr: Operator,
26
        group_id: int = UNDEFINED_GROUP_ID,
27
        children: List[int] = [],
28
    ):
29
        # remove this assert after fixing
30
        # optimizer_context:_xform_opr_to_group_expr
31
        assert (
1✔
32
            len(opr.children) == 0
33
        ), """Cannot create a group expression
34
                                from operator with children"""
35
        self._opr = opr
1✔
36
        self._group_id = group_id
1✔
37
        self._children = children
1✔
38
        self._rules_explored = RuleType.INVALID_RULE
1✔
39

40
    @property
1✔
41
    def opr(self):
1✔
42
        return self._opr
1✔
43

44
    @property
1✔
45
    def group_id(self):
1✔
46
        return self._group_id
1✔
47

48
    @group_id.setter
1✔
49
    def group_id(self, new_id):
1✔
50
        self._group_id = new_id
1✔
51

52
    @property
1✔
53
    def children(self):
1✔
54
        return self._children
1✔
55

56
    @children.setter
1✔
57
    def children(self, new_children):
1✔
58
        self._children = new_children
×
59

60
    def append_child(self, child_id: int):
1✔
61
        self._children.append(child_id)
×
62

63
    @property
1✔
64
    def rules_explored(self):
1✔
65
        return self._rules_explored
×
66

67
    def is_logical(self):
1✔
68
        return self.opr.is_logical()
1✔
69

70
    def mark_rule_explored(self, rule_id: RuleType):
1✔
71
        self._rules_explored |= rule_id
1✔
72

73
    def is_rule_explored(self, rule_id: RuleType):
1✔
74
        return (self._rules_explored & rule_id) == rule_id
1✔
75

76
    def __eq__(self, other: "GroupExpression"):
1✔
77
        if not isinstance(other, GroupExpression):
×
78
            return False
×
79
        return (
×
80
            self.group_id == other.group_id
81
            and self.opr == other.opr
82
            and self.children == other.children
83
        )
84

85
    def __str__(self) -> str:
1✔
86
        return "%s(%s)" % (
1✔
87
            type(self).__name__,
88
            ", ".join("%s=%s" % item for item in vars(self).items()),
89
        )
90

91
    def __hash__(self):
1✔
92
        return hash((self.opr, tuple(self.children)))
1✔
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