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

georgia-tech-db / eva / e6161546-9e33-42e7-a2b6-f8fbe6aa8255

08 Sep 2023 02:22AM UTC coverage: 80.449% (-12.5%) from 92.929%
e6161546-9e33-42e7-a2b6-f8fbe6aa8255

push

circle-ci

jiashenC
fix lint

13 of 13 new or added lines in 8 files covered. (100.0%)

9398 of 11682 relevant lines covered (80.45%)

1.45 hits per line

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

72.0
/evadb/catalog/models/function_cache_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
2✔
16
from typing import Tuple
2✔
17

18
from sqlalchemy import Column, ForeignKey, Integer, String, UniqueConstraint
2✔
19
from sqlalchemy.orm import relationship
2✔
20

21
from evadb.catalog.models.association_models import (
2✔
22
    depend_column_and_function_cache,
23
    depend_function_and_function_cache,
24
)
25
from evadb.catalog.models.base_model import BaseModel
2✔
26
from evadb.catalog.models.utils import FunctionCacheCatalogEntry
2✔
27

28

29
class FunctionCacheCatalog(BaseModel):
2✔
30
    """The `FunctionCacheCatalog` catalog stores information about the function cache.
31

32
    It maintains the following information for each cache entry:
33
    `_row_id:` An autogenerated identifier for the cache entry.
34
    `_name:` The name of the cache, also referred to as the unique function signature.
35
    `_function_id:` `_row_id` of the function in the `FunctionCatalog` for which the cache is built.
36
    `_args:` A serialized list of `ColumnCatalog` `_row_id`s for each argument of the
37
    Function. If the argument is a function expression, it stores the string representation
38
    of the expression tree.
39
    """
40

41
    __tablename__ = "function_cache"
2✔
42

43
    _name = Column("name", String(128))
2✔
44
    _function_id = Column(
2✔
45
        "function_id",
46
        Integer,
47
        ForeignKey("function_catalog._row_id", ondelete="CASCADE"),
48
    )
49
    _cache_path = Column("cache_path", String(256))
2✔
50
    _args = Column("args", String(1024))
2✔
51

52
    __table_args__ = (UniqueConstraint("name", "function_id"), {})
2✔
53

54
    _col_depends = relationship(
2✔
55
        "ColumnCatalog",
56
        secondary=depend_column_and_function_cache,
57
        back_populates="_dep_caches",
58
        # cascade="all, delete-orphan",
59
    )
60

61
    _function_depends = relationship(
2✔
62
        "FunctionCatalog",
63
        secondary=depend_function_and_function_cache,
64
        back_populates="_dep_caches",
65
        # cascade="all, delete-orphan",
66
    )
67

68
    def __init__(self, name: str, function_id: int, cache_path: str, args: Tuple[str]):
2✔
69
        self._name = name
×
70
        self._function_id = function_id
×
71
        self._cache_path = cache_path
×
72
        self._args = str(args)
×
73

74
    def as_dataclass(self) -> "FunctionCacheCatalogEntry":
2✔
75
        function_depends = [obj._row_id for obj in self._function_depends]
×
76
        col_depends = [obj._row_id for obj in self._col_depends]
×
77
        return FunctionCacheCatalogEntry(
×
78
            row_id=self._row_id,
79
            name=self._name,
80
            function_id=self._function_id,
81
            cache_path=self._cache_path,
82
            args=literal_eval(self._args),
83
            function_depends=function_depends,
84
            col_depends=col_depends,
85
        )
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