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

georgia-tech-db / eva / #758

04 Sep 2023 08:37PM UTC coverage: 0.0% (-78.3%) from 78.333%
#758

push

circle-ci

hershd23
Increased underline length in at line 75 in text_summarization.rst
	modified:   docs/source/benchmarks/text_summarization.rst

0 of 11303 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/catalog/models/udf_io_catalog.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 ast import literal_eval
×
16
from typing import Tuple
×
17

18
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, UniqueConstraint
×
19
from sqlalchemy.orm import relationship
×
20
from sqlalchemy.types import Enum
×
21

22
from evadb.catalog.catalog_type import ColumnType, Dimension, NdArrayType
×
23
from evadb.catalog.models.base_model import BaseModel
×
24
from evadb.catalog.models.utils import UdfIOCatalogEntry
×
25

26

27
class UdfIOCatalog(BaseModel):
×
28
    """The `UdfIOCatalog` catalog stores information about the input and output
29
    attributes of user-defined functions (UDFs). It maintains the following information
30
    for each attribute:
31
    `_row_id:` an autogenerated identifier
32
    `_name: ` name of the input/output argument
33
    `_type:` the type of the argument, refer `ColumnType`
34
    `_is_nullable:` which indicates whether it is nullable
35
    `_array_type:` the type of array, as specified in `NdArrayType` (or `None` if the attribute is a primitive type)
36
    `_array_dimensions:` the dimensions of the array (if `_array_type` is not `None`)
37
    `_udf_id:` the `_row_id` of the `UdfCatalog` entry to which the attribute belongs
38
    """
39

40
    __tablename__ = "udfio_catalog"
×
41

42
    _name = Column("name", String(100))
×
43
    _type = Column("type", Enum(ColumnType), default=Enum)
×
44
    _is_nullable = Column("is_nullable", Boolean, default=False)
×
45
    _array_type = Column("array_type", Enum(NdArrayType), nullable=True)
×
46
    _array_dimensions = Column("array_dimensions", String(100))
×
47
    _is_input = Column("is_input", Boolean, default=True)
×
48
    _udf_id = Column("udf_id", Integer, ForeignKey("udf_catalog._row_id"))
×
49

50
    __table_args__ = (UniqueConstraint("name", "udf_id"), {})
×
51

52
    # Foreign key dependency with the udf catalog
53
    _udf = relationship("UdfCatalog", back_populates="_attributes")
×
54

55
    def __init__(
×
56
        self,
57
        name: str,
58
        type: ColumnType,
59
        is_nullable: bool = False,
60
        array_type: NdArrayType = None,
61
        array_dimensions: Tuple[int] = None,
62
        is_input: bool = True,
63
        udf_id: int = None,
64
    ):
65
        self._name = name
×
66
        self._type = type
×
67
        self._is_nullable = is_nullable
×
68
        self._array_type = array_type
×
69
        self.array_dimensions = array_dimensions or str(())
×
70
        self._is_input = is_input
×
71
        self._udf_id = udf_id
×
72

73
    @property
×
74
    def array_dimensions(self):
×
75
        return literal_eval(self._array_dimensions)
×
76

77
    @array_dimensions.setter
×
78
    def array_dimensions(self, value: Tuple[int]):
×
79
        # Refer df_column.py:array_dimensions
80
        if not isinstance(value, tuple):
×
81
            self._array_dimensions = str(value)
×
82
        else:
83
            dimensions = []
×
84
            for dim in value:
×
85
                if dim == Dimension.ANYDIM:
×
86
                    dimensions.append(None)
×
87
                else:
88
                    dimensions.append(dim)
×
89
            self._array_dimensions = str(tuple(dimensions))
×
90

91
    def as_dataclass(self) -> "UdfIOCatalogEntry":
×
92
        return UdfIOCatalogEntry(
×
93
            row_id=self._row_id,
94
            name=self._name,
95
            type=self._type,
96
            is_nullable=self._is_nullable,
97
            array_type=self._array_type,
98
            array_dimensions=self.array_dimensions,
99
            is_input=self._is_input,
100
            udf_id=self._udf_id,
101
            udf_name=self._udf._name,
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