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

georgia-tech-db / eva / #832

12 Oct 2023 08:31AM UTC coverage: 0.0% (-68.5%) from 68.493%
#832

push

circle-ci

xzdandy
Minor

0 of 12331 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/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
×
16
from typing import Tuple
×
17

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

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

28

29
class FunctionCacheCatalog(BaseModel):
×
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"
×
42

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

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

54
    _col_depends = relationship(
×
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(
×
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]):
×
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":
×
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