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

georgia-tech-db / eva / 403cc1a5-0f02-4b8f-a3f0-a3876612f17d

pending completion
403cc1a5-0f02-4b8f-a3f0-a3876612f17d

Pull #732

circle-ci

Yulai Cui
test reformat
Pull Request #732: feat: OVERWRITE statement

345 of 345 new or added lines in 21 files covered. (100.0%)

9560 of 9786 relevant lines covered (97.69%)

0.98 hits per line

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

95.83
/eva/parser/overwrite_statement.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 eva.expression.abstract_expression import AbstractExpression
1✔
16
from eva.parser.statement import AbstractStatement
1✔
17
from eva.parser.table_ref import TableRef
1✔
18
from eva.parser.types import StatementType
1✔
19

20

21
class OverwriteStatement(AbstractStatement):
1✔
22
    """
23
    Overwrite Data Statement constructed after parsing the input query
24

25
    Arguments:
26
    table (TableRef): table to overwrite
27
    operation (AbstractExpression): overwrite the data with the result of operation
28
    """
29

30
    def __init__(self, table_ref: TableRef, operation: AbstractExpression):
1✔
31
        super().__init__(StatementType.OVERWRITE)
1✔
32
        self._table_ref = table_ref
1✔
33
        self._operation = operation
1✔
34

35
    def __str__(self) -> str:
1✔
36
        overwrite_stmt_str = "OVERWRITE {} BY {}".format(
1✔
37
            self._table_ref, self._operation
38
        )
39
        return overwrite_stmt_str
1✔
40

41
    @property
1✔
42
    def table_ref(self) -> TableRef:
1✔
43
        return self._table_ref
1✔
44

45
    @property
1✔
46
    def operation(self) -> AbstractExpression:
1✔
47
        return self._operation
1✔
48

49
    def __eq__(self, other):
1✔
50
        if not isinstance(other, OverwriteStatement):
1✔
51
            return False
1✔
52
        return (
1✔
53
            self._table_ref == other._table_ref and self._operation == other._operation
54
        )
55

56
    def __hash__(self) -> int:
1✔
57
        return hash(
×
58
            (
59
                super().__hash__(),
60
                self._table_ref,
61
                self._operation,
62
            )
63
        )
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