• 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/parser/load_statement.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 pathlib import Path
×
UNCOV
16
from typing import List
×
17

UNCOV
18
from evadb.expression.abstract_expression import AbstractExpression
×
UNCOV
19
from evadb.parser.statement import AbstractStatement
×
UNCOV
20
from evadb.parser.table_ref import TableInfo
×
UNCOV
21
from evadb.parser.types import StatementType
×
22

23

UNCOV
24
class LoadDataStatement(AbstractStatement):
×
25
    """
26
    Load Data Statement constructed after parsing the input query
27

28
    Arguments:
29
    table (TableInfo): table to load into
30
    path (str): path from where data needs to be loaded
31
    """
32

UNCOV
33
    def __init__(
×
34
        self,
35
        table_info: TableInfo,
36
        path: str,
37
        column_list: List[AbstractExpression] = None,
38
        file_options: dict = None,
39
    ):
UNCOV
40
        super().__init__(StatementType.LOAD_DATA)
×
UNCOV
41
        self._table_info = table_info
×
UNCOV
42
        self._path = Path(path)
×
UNCOV
43
        self._column_list = column_list
×
UNCOV
44
        self._file_options = file_options
×
45

UNCOV
46
    def __str__(self) -> str:
×
UNCOV
47
        file_option_str = ""
×
UNCOV
48
        for key, value in self._file_options.items():
×
UNCOV
49
            file_option_str += f"{str(key)}: {str(value)}"
×
50

UNCOV
51
        column_list_str = ""
×
UNCOV
52
        if self._column_list is not None:
×
UNCOV
53
            for col in self._column_list:
×
UNCOV
54
                column_list_str += str(col) + ", "
×
UNCOV
55
            column_list_str = column_list_str.rstrip(", ")
×
56

UNCOV
57
        if self._column_list is None:
×
UNCOV
58
            load_stmt_str = "LOAD {} INTO {} WITH {}".format(
×
59
                self._path.name, self._table_info, file_option_str
60
            )
61
        else:
UNCOV
62
            load_stmt_str = "LOAD {} INTO {} ({}) WITH {}".format(
×
63
                self._path.name, self._table_info, column_list_str, file_option_str
64
            )
UNCOV
65
        return load_stmt_str
×
66

UNCOV
67
    @property
×
UNCOV
68
    def table_info(self) -> TableInfo:
×
UNCOV
69
        return self._table_info
×
70

UNCOV
71
    @property
×
UNCOV
72
    def path(self) -> Path:
×
UNCOV
73
        return self._path
×
74

UNCOV
75
    @property
×
UNCOV
76
    def column_list(self) -> List[AbstractExpression]:
×
UNCOV
77
        return self._column_list
×
78

UNCOV
79
    @property
×
UNCOV
80
    def file_options(self) -> dict:
×
UNCOV
81
        return self._file_options
×
82

UNCOV
83
    def __eq__(self, other):
×
UNCOV
84
        if not isinstance(other, LoadDataStatement):
×
UNCOV
85
            return False
×
UNCOV
86
        return (
×
87
            self.table_info == other.table_info
88
            and self.path == other.path
89
            and self.column_list == other.column_list
90
            and self.file_options == other.file_options
91
        )
92

UNCOV
93
    def __hash__(self) -> int:
×
UNCOV
94
        return hash(
×
95
            (
96
                super().__hash__(),
97
                self.table_info,
98
                self.path,
99
                tuple(self.column_list or []),
100
                frozenset(self.file_options.items()),
101
            )
102
        )
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