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

georgia-tech-db / eva / #725

pending completion
#725

push

circle-ci

web-flow
chore: reducing coverage loss (#619)

* adding delete operation

* Adding Insert Statement

* checkpoint

* supporting multiple entries

* implemented for structured data error

* adding parser visitor for delete

* delete executor

* delete plan and rules

* adding delete to plan executor

* change position of LogicalDelete

* logical delimeter

* delete test case

* adding test case

* adding test case

* adding delete testcase

* adding predicate to delete executor

* adding delete to Image storage

* bug fix in delete

* fixing testcase

* adding test case for insert statement

* remove order_by from statement_binder.py

* better variable names, using Batch

* error message for insert

* removing order_by and limit from delete

* remove order_by and limit

* use f-string

* adding to changelog

* removing commit messages

* formatting

* fixing comments

* formatting

* eva insert f32 values

* fix: should delete range

* delete multiple rows

* udf bootstrap

* try to run tests in parallel

* minor fix for ray to work

* ray fixes

---------

Co-authored-by: Aryan-Rajoria <aryanrajoria1003@gmail.com>
Co-authored-by: Gaurav <gaurav21776@gmail.com>

236 of 236 new or added lines in 53 files covered. (100.0%)

7003 of 9005 relevant lines covered (77.77%)

0.78 hits per line

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

88.71
/eva/expression/tuple_value_expression.py
1
# coding=utf-8
2
# Copyright 2018-2022 EVA
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 Union
1✔
16

17
from eva.catalog.models.column_catalog import ColumnCatalogEntry
1✔
18
from eva.catalog.models.udf_io_catalog import UdfIOCatalogEntry
1✔
19
from eva.models.storage.batch import Batch
1✔
20

21
from .abstract_expression import (
1✔
22
    AbstractExpression,
23
    ExpressionReturnType,
24
    ExpressionType,
25
)
26

27

28
class TupleValueExpression(AbstractExpression):
1✔
29
    def __init__(
1✔
30
        self,
31
        col_name: str = None,
32
        table_alias: str = None,
33
        col_idx: int = -1,
34
        col_object: Union[ColumnCatalogEntry, UdfIOCatalogEntry] = None,
35
        col_alias=None,
36
    ):
37
        super().__init__(ExpressionType.TUPLE_VALUE, rtype=ExpressionReturnType.INVALID)
1✔
38
        self._col_name = col_name
1✔
39
        self._table_alias = table_alias
1✔
40
        self._table_id = None
1✔
41
        self._col_idx = col_idx
1✔
42
        self._col_object = col_object
1✔
43
        self._col_alias = col_alias
1✔
44

45
    @property
1✔
46
    def table_id(self) -> int:
1✔
47
        return self._table_id
1✔
48

49
    @property
1✔
50
    def table_alias(self) -> str:
1✔
51
        return self._table_alias
1✔
52

53
    @property
1✔
54
    def col_name(self) -> str:
1✔
55
        return self._col_name
1✔
56

57
    @property
1✔
58
    def col_object(self) -> Union[ColumnCatalogEntry, UdfIOCatalogEntry]:
1✔
59
        return self._col_object
1✔
60

61
    @col_object.setter
1✔
62
    def col_object(self, value: Union[ColumnCatalogEntry, UdfIOCatalogEntry]):
1✔
63
        self._col_object = value
×
64

65
    @property
1✔
66
    def col_alias(self) -> str:
1✔
67
        return self._col_alias
1✔
68

69
    @col_alias.setter
1✔
70
    def col_alias(self, value: str):
1✔
71
        self._col_alias = value
1✔
72

73
    def evaluate(self, batch: Batch, *args, **kwargs):
1✔
74
        if "mask" in kwargs:
1✔
75
            batch = batch[kwargs["mask"]]
1✔
76
        return batch.project([self.col_alias])
1✔
77

78
    def signature(self):
1✔
79
        """It constructs the signature of the tuple value expression.
80
        It assumes the col_object attribute is populated by the binder with the catalog
81
        entries. For a standard column in the table, it returns `table_name.col_name`,
82
        and for UDF output columns it returns `udf_name.col_name`
83
        Raises:
84
            ValueError: If the col_object is not a `Union[ColumnCatalogEntry, UdfIOCatalogEntry]`. This can occur if the expression has not been bound using the binder.
85
        Returns:
86
            str: signature string
87
        """
88
        assert isinstance(self.col_object, ColumnCatalogEntry) or isinstance(
×
89
            self.col_object, UdfIOCatalogEntry
90
        ), f"Unsupported type of self.col_object {type(self.col_object)}, expected ColumnCatalogEntry or UdfIOCatalogEntry"
91

92
        if isinstance(self.col_object, ColumnCatalogEntry):
×
93
            return f"{self.col_object.table_name}.{self.col_object.name}"
×
94
        elif isinstance(self.col_object, UdfIOCatalogEntry):
×
95
            return f"{self.col_object.udf_name}.{self.col_object.name}"
×
96

97
    def __eq__(self, other):
1✔
98
        is_subtree_equal = super().__eq__(other)
1✔
99
        if not isinstance(other, TupleValueExpression):
1✔
100
            return False
1✔
101
        return (
1✔
102
            is_subtree_equal
103
            and self.table_alias == other.table_alias
104
            and self.table_id == other.table_id
105
            and self.col_name == other.col_name
106
            and self.col_alias == other.col_alias
107
            and self.col_object == other.col_object
108
            and self._col_idx == other._col_idx
109
        )
110

111
    def __str__(self) -> str:
1✔
112
        expr_str = ""
1✔
113
        if self.table_alias:
1✔
114
            expr_str += f"{str(self.table_alias)}."
1✔
115
        if self.col_name:
1✔
116
            expr_str += f"{str(self.col_name)}"
1✔
117
        if self.col_alias:
1✔
118
            expr_str += f" AS {str(self.col_alias)}"
×
119
        expr_str += ""
1✔
120
        return expr_str
1✔
121

122
    def __hash__(self) -> int:
1✔
123
        return hash(
1✔
124
            (
125
                super().__hash__(),
126
                self.table_alias,
127
                self.table_id,
128
                self.col_name,
129
                self.col_alias,
130
                self.col_object,
131
                self._col_idx,
132
            )
133
        )
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