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

georgia-tech-db / eva / #754

04 Sep 2023 09:54PM UTC coverage: 74.807% (-5.5%) from 80.336%
#754

push

circle-ci

jiashenC
update case

8727 of 11666 relevant lines covered (74.81%)

0.75 hits per line

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

83.78
/evadb/parser/lark_visitor/_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 lark.tree import Tree
1✔
16

17
from evadb.parser.load_statement import LoadDataStatement
1✔
18
from evadb.parser.types import FileFormatType
1✔
19

20

21
class Load:
1✔
22
    def load_statement(self, tree):
1✔
23
        # Set default file_format
24
        file_format = FileFormatType.VIDEO
1✔
25
        file_format = self.visit(tree.children[1])
1✔
26

27
        # Set default for file_format as Video
28
        file_options = {}
1✔
29
        file_options["file_format"] = file_format
1✔
30

31
        file_path = self.visit(tree.children[2]).value
1✔
32
        table = self.visit(tree.children[4])
1✔
33

34
        # set default for column_list as None
35
        column_list = None
1✔
36
        for child in tree.children:
1✔
37
            if isinstance(child, Tree):
1✔
38
                if child.data == "uid_list":
1✔
39
                    column_list = self.visit(child)
1✔
40

41
        stmt = LoadDataStatement(table, file_path, column_list, file_options)
1✔
42
        return stmt
1✔
43

44
    def file_format(self, tree):
1✔
45
        file_format = None
1✔
46
        file_format_string = tree.children[0]
1✔
47

48
        if file_format_string == "VIDEO":
1✔
49
            file_format = FileFormatType.VIDEO
1✔
50
        elif file_format_string == "CSV":
1✔
51
            file_format = FileFormatType.CSV
1✔
52
        elif file_format_string == "IMAGE":
1✔
53
            file_format = FileFormatType.IMAGE
1✔
54
        elif file_format_string == "DOCUMENT":
1✔
55
            file_format = FileFormatType.DOCUMENT
×
56
        elif file_format_string == "PDF":
1✔
57
            file_format = FileFormatType.PDF
×
58

59
        return file_format
1✔
60

61
    def file_options(self, tree):
1✔
62
        file_options = {}
×
63
        file_format = self.visit(tree.children[1])
×
64
        file_options["file_format"] = file_format
×
65
        return file_options
×
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