Skip to content

Commit

Permalink
feat: function_metadata supports boolean and float (georgia-tech-db#1296
Browse files Browse the repository at this point in the history
  • Loading branch information
gaurav274 authored and a0x8o committed Nov 22, 2023
1 parent f9b931f commit 2e202f3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions evadb/catalog/models/function_metadata_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@

from evadb.catalog.models.base_model import BaseModel
<<<<<<< HEAD
<<<<<<< HEAD
from evadb.catalog.models.utils import FunctionMetadataCatalogEntry, TextPickleType
=======
from evadb.catalog.models.utils import FunctionMetadataCatalogEntry
>>>>>>> 2dacff69 (feat: sync master staging (#1050))
=======
from evadb.catalog.models.utils import FunctionMetadataCatalogEntry, TextPickleType
>>>>>>> e0596f63 (feat: function_metadata supports boolean and float (#1296))


class FunctionMetadataCatalog(BaseModel):
Expand All @@ -38,11 +42,15 @@ class FunctionMetadataCatalog(BaseModel):
__tablename__ = "function_metadata_catalog"

_key = Column("key", String(100))
<<<<<<< HEAD
<<<<<<< HEAD
_value = Column("value", TextPickleType())
=======
_value = Column("value", String(100))
>>>>>>> 2dacff69 (feat: sync master staging (#1050))
=======
_value = Column("value", TextPickleType())
>>>>>>> e0596f63 (feat: function_metadata supports boolean and float (#1296))
_function_id = Column(
"function_id", Integer, ForeignKey("function_catalog._row_id")
)
Expand Down
4 changes: 4 additions & 0 deletions evadb/parser/evadb.lark
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,15 @@ function_metadata: function_metadata_key function_metadata_value

function_metadata_key: uid

<<<<<<< HEAD
<<<<<<< HEAD
function_metadata_value: constant
=======
function_metadata_value: string_literal | decimal_literal
>>>>>>> 2dacff69 (feat: sync master staging (#1050))
=======
function_metadata_value: constant
>>>>>>> e0596f63 (feat: function_metadata supports boolean and float (#1296))

<<<<<<< HEAD
vector_store_type: USING (FAISS | QDRANT | PINECONE | PGVECTOR | CHROMADB | MILVUS)
Expand Down
20 changes: 20 additions & 0 deletions test/integration_tests/long/test_function_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,22 +228,29 @@ def test_should_create_function_with_metadata(self):
TYPE Classification
IMPL 'test/util.py'
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> e0596f63 (feat: function_metadata supports boolean and float (#1296))
CACHE TRUE
BATCH FALSE
INT_VAL 1
FLOAT_VAL 1.5
STR_VAL "gg";
<<<<<<< HEAD
=======
CACHE 'TRUE'
BATCH 'FALSE';
>>>>>>> 2dacff69 (feat: sync master staging (#1050))
=======
>>>>>>> e0596f63 (feat: function_metadata supports boolean and float (#1296))
"""
execute_query_fetch_all(self.evadb, create_function_query.format(function_name))

# try fetching the metadata values
entries = self.evadb.catalog().get_function_metadata_entries_by_function_name(
function_name
)
<<<<<<< HEAD
<<<<<<< HEAD
self.assertEqual(len(entries), 5)
metadata = [(entry.key, entry.value) for entry in entries]
Expand All @@ -263,6 +270,19 @@ def test_should_create_function_with_metadata(self):
# metadata ultimately stored as lowercase string literals in metadata
expected_metadata = [("cache", "TRUE"), ("batch", "FALSE")]
>>>>>>> 2dacff69 (feat: sync master staging (#1050))
=======
self.assertEqual(len(entries), 5)
metadata = [(entry.key, entry.value) for entry in entries]

# metadata ultimately stored as lowercase string literals in metadata
expected_metadata = [
("cache", True),
("batch", False),
("int_val", 1),
("float_val", 1.5),
("str_val", "gg"),
]
>>>>>>> e0596f63 (feat: function_metadata supports boolean and float (#1296))
self.assertEqual(set(metadata), set(expected_metadata))

def test_should_return_empty_metadata_list_for_missing_function(self):
Expand Down

0 comments on commit 2e202f3

Please sign in to comment.