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

georgia-tech-db / eva / #820

01 Oct 2023 02:22AM UTC coverage: 0.0% (-73.7%) from 73.748%
#820

push

circle-ci

Jiashen Cao
fix lint error

0 of 12361 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/create_index_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 typing import List
×
16

17
from evadb.catalog.catalog_type import VectorStoreType
×
18
from evadb.expression.abstract_expression import AbstractExpression
×
19
from evadb.expression.function_expression import FunctionExpression
×
20
from evadb.parser.create_statement import ColumnDefinition
×
21
from evadb.parser.statement import AbstractStatement
×
22
from evadb.parser.table_ref import TableRef
×
23
from evadb.parser.types import StatementType
×
24

25

26
class CreateIndexStatement(AbstractStatement):
×
27
    def __init__(
×
28
        self,
29
        name: str,
30
        if_not_exists: bool,
31
        table_ref: TableRef,
32
        col_list: List[ColumnDefinition],
33
        vector_store_type: VectorStoreType,
34
        project_expr_list: List[AbstractStatement] = None,
35
    ):
36
        super().__init__(StatementType.CREATE_INDEX)
×
37
        self._name = name
×
38
        self._if_not_exists = if_not_exists
×
39
        self._table_ref = table_ref
×
40
        self._col_list = col_list
×
41
        self._vector_store_type = vector_store_type
×
42
        self._project_expr_list = project_expr_list
×
43

44
    def __str__(self) -> str:
×
45
        function_expr = None
×
46
        for project_expr in self._project_expr_list:
×
47
            if isinstance(project_expr, FunctionExpression):
×
48
                function_expr = project_expr
×
49

50
        print_str = "CREATE INDEX {} {} ON {} ({}{}) ".format(
×
51
            self._name,
52
            "IF NOT EXISTS" if self._if_not_exists else "",
53
            self._table_ref,
54
            "" if function_expr is None else function_expr,
55
            tuple(self._col_list),
56
        )
57
        return print_str
×
58

59
    @property
×
60
    def name(self):
×
61
        return self._name
×
62

63
    @property
×
64
    def if_not_exists(self):
×
65
        return self._if_not_exists
×
66

67
    @property
×
68
    def table_ref(self):
×
69
        return self._table_ref
×
70

71
    @property
×
72
    def col_list(self):
×
73
        return self._col_list
×
74

75
    @property
×
76
    def vector_store_type(self):
×
77
        return self._vector_store_type
×
78

79
    @property
×
80
    def project_expr_list(self):
×
81
        return self._project_expr_list
×
82

83
    @project_expr_list.setter
×
84
    def project_expr_list(self, project_expr_list: List[AbstractExpression]):
×
85
        self._project_expr_list = project_expr_list
×
86

87
    def __eq__(self, other):
×
88
        if not isinstance(other, CreateIndexStatement):
×
89
            return False
×
90
        return (
×
91
            self._name == other.name
92
            and self._if_not_exists == other.if_not_exists
93
            and self._table_ref == other.table_ref
94
            and self.col_list == other.col_list
95
            and self._vector_store_type == other.vector_store_type
96
            and self._project_expr_list == other.project_expr_list
97
        )
98

99
    def __hash__(self) -> int:
×
100
        return hash(
×
101
            (
102
                super().__hash__(),
103
                self._name,
104
                self._if_not_exists,
105
                self._table_ref,
106
                tuple(self.col_list),
107
                self._vector_store_type,
108
                tuple(self._project_expr_list),
109
            )
110
        )
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