• 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

63.64
/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.
15
from pathlib import Path
1✔
16
from typing import List
1✔
17

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

23

24
class LoadDataStatement(AbstractStatement):
1✔
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

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

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

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

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

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

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

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

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

83
    def __eq__(self, other):
1✔
84
        if not isinstance(other, LoadDataStatement):
×
85
            return False
×
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

93
    def __hash__(self) -> int:
1✔
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

© 2025 Coveralls, Inc