diff --git a/.gitignore b/.gitignore index dc7ddbf5ed..697a42a819 100644 --- a/.gitignore +++ b/.gitignore @@ -226,5 +226,3 @@ eva_db/* eva/* blog.md - -tests/integration_tests/short/*.db diff --git a/docs/source/reference/evaql/set_config.rst b/docs/source/reference/evaql/set_config.rst index c45041b5a0..599fe0fc04 100644 --- a/docs/source/reference/evaql/set_config.rst +++ b/docs/source/reference/evaql/set_config.rst @@ -1,4 +1,4 @@ -SET CONFIGS +SET CONFIG ============== .. _set_config: @@ -8,8 +8,4 @@ Sets the value of a configuration parameter to the passed value. Both `TO` and ` .. code:: sql SET OPENAI_KEY TO "abc"; - SET OPENAI_KEY = "abc"; - -.. note:: - - The `SET` command does not support `CONFIG` or `CONFIGS` as keys names. This is because `CONFIG` and `CONFIGS` are reserved keywords. + SET OPENAI_KEY = "abc"; \ No newline at end of file diff --git a/docs/source/reference/evaql/show_config.rst b/docs/source/reference/evaql/show_config.rst index 0e7dba9960..2991f4c28e 100644 --- a/docs/source/reference/evaql/show_config.rst +++ b/docs/source/reference/evaql/show_config.rst @@ -1,4 +1,4 @@ -SHOW CONFIGS +SHOW CONFIG ============== .. _show_config: @@ -9,11 +9,3 @@ Returns the value of a specified configuration parameter. SHOW ; SHOW OPENAI_KEY; - -.. _show_configs: - -In order to see all the configuration parameters, use the following command: - -.. code:: sql - - SHOW CONFIGS; diff --git a/evadb/catalog/catalog_manager.py b/evadb/catalog/catalog_manager.py index 70d3e0acff..8482bf1bd6 100644 --- a/evadb/catalog/catalog_manager.py +++ b/evadb/catalog/catalog_manager.py @@ -786,6 +786,3 @@ def get_configuration_catalog_value(self, key: str, default: Any = None) -> Any: if table_entry: return table_entry.value return default - - def get_all_configuration_catalog_entries(self) -> List: - return self._config_catalog_service.get_all_entries() diff --git a/evadb/constants.py b/evadb/constants.py index 80777c5ab4..06e3973ea3 100644 --- a/evadb/constants.py +++ b/evadb/constants.py @@ -21,3 +21,5 @@ IFRAMES = "IFRAMES" AUDIORATE = "AUDIORATE" DEFAULT_FUNCTION_EXPRESSION_COST = 100 +DBFUNCTIONS = __file__[0: -13] + "/functions/" +ENVFUNCTIONS = "./Lib/site-packages/evadb/functions/" \ No newline at end of file diff --git a/evadb/evadb_config.py b/evadb/evadb_config.py index ec357fbd91..6117514b25 100644 --- a/evadb/evadb_config.py +++ b/evadb/evadb_config.py @@ -24,12 +24,6 @@ "evadb_installation_dir": "", "datasets_dir": "", "catalog_database_uri": "", - "index_dir": "", - "cache_dir": "", - "s3_download_dir": "", - "tmp_dir": "", - "function_dir": "", - "model_dir": "", "application": "evadb", "mode": "release", "batch_mem_size": 30000000, diff --git a/evadb/executor/set_executor.py b/evadb/executor/set_executor.py index 1acb9b3098..309fe2747c 100644 --- a/evadb/executor/set_executor.py +++ b/evadb/executor/set_executor.py @@ -16,8 +16,6 @@ from evadb.executor.abstract_executor import AbstractExecutor from evadb.parser.set_statement import SetStatement -RESERVED_CONFIG_KEYWORDS = ["CONFIG", "CONFIGS"] - class SetExecutor(AbstractExecutor): def __init__(self, db: EvaDBDatabase, node: SetStatement): @@ -39,13 +37,6 @@ def exec(self, *args, **kwargs): will be replaced """ - if self.node.config_name in RESERVED_CONFIG_KEYWORDS: - raise Exception( - "{} is a reserved keyword for configurations. Please use a word other than the following list: {}".format( - self.node.config_name, RESERVED_CONFIG_KEYWORDS - ) - ) - self.catalog().upsert_configuration_catalog_entry( key=self.node.config_name, value=self.node.config_value.value, diff --git a/evadb/executor/show_info_executor.py b/evadb/executor/show_info_executor.py index 87c4ef7063..16871b8435 100644 --- a/evadb/executor/show_info_executor.py +++ b/evadb/executor/show_info_executor.py @@ -33,7 +33,7 @@ def exec(self, *args, **kwargs): self.node.show_type is ShowType.FUNCTIONS or ShowType.TABLES or ShowType.DATABASES - or ShowType.CONFIGS + or ShowType.CONFIG ), f"Show command does not support type {self.node.show_type}" if self.node.show_type is ShowType.FUNCTIONS: @@ -50,23 +50,16 @@ def exec(self, *args, **kwargs): databases = self.catalog().get_all_database_catalog_entries() for db in databases: show_entries.append(db.display_format()) - elif self.node.show_type is ShowType.CONFIGS: + elif self.node.show_type is ShowType.CONFIG: + value = self.catalog().get_configuration_catalog_value( + key=self.node.show_val.upper(), + ) show_entries = {} - # CONFIGS is a special word, which is used to display all the configurations - if self.node.show_val.upper() == ShowType.CONFIGS.name: - configs = self.catalog().get_all_configuration_catalog_entries() - for config in configs: - show_entries[config.key] = config.value + if value is not None: + show_entries = {self.node.show_val: [value]} else: - value = self.catalog().get_configuration_catalog_value( - key=self.node.show_val.upper(), + raise Exception( + "No configuration found with key {}".format(self.node.show_val) ) - show_entries = {} - if value is not None: - show_entries = {self.node.show_val: [value]} - else: - raise Exception( - "No configuration found with key {}".format(self.node.show_val) - ) yield Batch(pd.DataFrame(show_entries)) diff --git a/evadb/functions/function_bootstrap_queries.py b/evadb/functions/function_bootstrap_queries.py index 3b50085864..fa4dac4c42 100644 --- a/evadb/functions/function_bootstrap_queries.py +++ b/evadb/functions/function_bootstrap_queries.py @@ -20,6 +20,7 @@ NDARRAY_DIR = "ndarray" TUTORIALS_DIR = "tutorials" + DummyObjectDetector_function_query = """CREATE FUNCTION IF NOT EXISTS DummyObjectDetector INPUT (Frame_Array NDARRAY INT8(3, ANYDIM, ANYDIM)) OUTPUT (label NDARRAY STR(1)) @@ -289,8 +290,8 @@ def init_builtin_functions(db: EvaDBDatabase, mode: str = "debug") -> None: stablediffusion_function_query, dalle_function_query, Upper_function_query, - Lower_function_query, Concat_function_query, + Lower_function_query, ] # if mode is 'debug', add debug functions @@ -313,4 +314,4 @@ def init_builtin_functions(db: EvaDBDatabase, mode: str = "debug") -> None: db, query, do_not_print_exceptions=False, do_not_raise_exceptions=True ) except Exception: - pass + pass \ No newline at end of file diff --git a/evadb/parser/create_function_statement.py b/evadb/parser/create_function_statement.py index eb35fcffaa..64414295d5 100644 --- a/evadb/parser/create_function_statement.py +++ b/evadb/parser/create_function_statement.py @@ -15,6 +15,7 @@ from pathlib import Path from typing import List, Tuple +from evadb.configuration.constants import EvaDB_INSTALLATION_DIR from evadb.parser.create_statement import ColumnDefinition from evadb.parser.select_statement import SelectStatement from evadb.parser.statement import AbstractStatement @@ -64,7 +65,18 @@ def __init__( self._if_not_exists = if_not_exists self._inputs = inputs self._outputs = outputs - self._impl_path = Path(impl_path) if impl_path else None + + if impl_path: + if len(str(impl_path)) < 12: + self._impl_path = Path(impl_path) + elif "DBFUNCTIONS" == str(impl_path)[0:11] and (str(impl_path)[11:12] == "." or str(impl_path)[11:12] == "\\" or str(impl_path)[11:12] == "/"): + self._impl_path = Path(str(EvaDB_INSTALLATION_DIR) + "\\functions\\" + str(impl_path)[12:]) + elif "ENVFUNCTIONS" == str(impl_path)[0:12] and (str(impl_path)[12:13] == "." or str(impl_path)[12:13] == "\\" or str(impl_path)[12:13] == "/"): + self._impl_path = Path( "..\\functions\\" + str(impl_path)[13:]) + else: + self._impl_path = Path(impl_path) + else: + self._impl_path = None self._function_type = function_type self._query = query self._metadata = metadata @@ -171,4 +183,4 @@ def __hash__(self) -> int: self.query, tuple(self.metadata), ) - ) + ) \ No newline at end of file diff --git a/evadb/parser/lark_visitor/_functions.py b/evadb/parser/lark_visitor/_functions.py index 2b2c180953..a3b5a868af 100644 --- a/evadb/parser/lark_visitor/_functions.py +++ b/evadb/parser/lark_visitor/_functions.py @@ -151,8 +151,6 @@ def aggregate_windowed_function(self, tree): # Support for COUNT(*) if token != "*": agg_func_name = token - elif token == "*": - agg_func_arg = TupleValueExpression(name="_row_id") else: agg_func_arg = TupleValueExpression(name="id") diff --git a/evadb/parser/lark_visitor/_show_statements.py b/evadb/parser/lark_visitor/_show_statements.py index 9340b1d9b8..ca9581aca7 100644 --- a/evadb/parser/lark_visitor/_show_statements.py +++ b/evadb/parser/lark_visitor/_show_statements.py @@ -30,4 +30,4 @@ def show_statement(self, tree): elif isinstance(token, str) and str.upper(token) == "DATABASES": return ShowStatement(show_type=ShowType.DATABASES) elif token is not None: - return ShowStatement(show_type=ShowType.CONFIGS, show_val=self.visit(token)) + return ShowStatement(show_type=ShowType.CONFIG, show_val=self.visit(token)) diff --git a/evadb/parser/show_statement.py b/evadb/parser/show_statement.py index 857a35d1b1..d7eca052f2 100644 --- a/evadb/parser/show_statement.py +++ b/evadb/parser/show_statement.py @@ -40,7 +40,7 @@ def __str__(self): show_str = "FUNCTIONS" elif self.show_type == ShowType.TABLES: show_str = "TABLES" - elif self.show_type == ShowType.CONFIGS: + elif self.show_type == ShowType.CONFIG: show_str = self.show_val elif self.show_type == ShowType.DATABASES: show_str = "DATABASES" diff --git a/evadb/parser/types.py b/evadb/parser/types.py index 0ea68a5f56..227a768c7b 100644 --- a/evadb/parser/types.py +++ b/evadb/parser/types.py @@ -71,7 +71,7 @@ class FileFormatType(EvaDBEnum): class ShowType(EvaDBEnum): FUNCTIONS # noqa: F821 TABLES # noqa: F821 - CONFIGS # noqa: F821 + CONFIG # noqa: F821 DATABASES # noqa: F821 diff --git a/evadb/plan_nodes/show_info_plan.py b/evadb/plan_nodes/show_info_plan.py index b47afd56e5..733cc0401d 100644 --- a/evadb/plan_nodes/show_info_plan.py +++ b/evadb/plan_nodes/show_info_plan.py @@ -40,7 +40,7 @@ def __str__(self): return "ShowDatabasePlan" elif self._show_type == ShowType.TABLES: return "ShowTablePlan" - elif self._show_type == ShowType.CONFIGS: + elif self._show_type == ShowType.CONFIG: return "ShowConfigPlan" def __hash__(self) -> int: diff --git a/test/integration_tests/short/test_select_executor.py b/test/integration_tests/short/test_select_executor.py index 6baafc00dc..c2ac348c78 100644 --- a/test/integration_tests/short/test_select_executor.py +++ b/test/integration_tests/short/test_select_executor.py @@ -293,38 +293,6 @@ def test_select_and_groupby_with_sample(self): expected_batch.project(["FIRST.id", "SEGMENT.data"]), ) - def test_select_and_groupby_and_aggregate_with_pdf(self): - GROUPBY_SIZE = 8 - execute_query_fetch_all(self.evadb, "DROP TABLE IF EXISTS MyPDFs;") - # load from directory - pdf_path = ( - "test/data/uadetrac/small-data/pdf_data/fall_2023_orientation_document.pdf" - ) - load_query = f"LOAD PDF '{pdf_path}' INTO MyPDFs;" - execute_query_fetch_all(self.evadb, load_query) - select_all_query = "SELECT * FROM MyPDFs;" - all_pdf_batch = execute_query_fetch_all(self.evadb, select_all_query) - - select_query = ( - f"SELECT COUNT(*) FROM MyPDFs GROUP BY '{GROUPBY_SIZE} paragraphs';" - ) - actual_batch = execute_query_fetch_all(self.evadb, select_query) - - self.assertAlmostEqual( - len(all_pdf_batch), - len(actual_batch) * actual_batch.frames.iloc[0, 0], - None, - None, - GROUPBY_SIZE, - ) - self.assertEqual(len(actual_batch), 99) - n = len(actual_batch) - for i in range(n): - self.assertEqual(actual_batch.frames.iloc[i, 0], GROUPBY_SIZE) - - # tear down - execute_query_fetch_all(self.evadb, "DROP TABLE IF EXISTS MyPDFs;") - def test_lateral_join_with_unnest_and_sample(self): query = """SELECT id, label FROM MyVideo SAMPLE 2 JOIN LATERAL diff --git a/test/integration_tests/short/test_show_info_executor.py b/test/integration_tests/short/test_show_info_executor.py index cba59227e6..f875d266e0 100644 --- a/test/integration_tests/short/test_show_info_executor.py +++ b/test/integration_tests/short/test_show_info_executor.py @@ -21,7 +21,6 @@ import pytest from evadb.configuration.constants import EvaDB_ROOT_DIR -from evadb.evadb_config import BASE_EVADB_CONFIG from evadb.functions.function_bootstrap_queries import ( ArrayCount_function_query, Fastrcnn_function_query, @@ -119,6 +118,7 @@ def test_show_tables(self): def test_show_config_execution(self): execute_query_fetch_all(self.evadb, "SET OPENAIKEY = 'ABCD';") + # expected_output = Batch(pd.DataFrame({"OPENAIKEY": ["ABCD"]})) show_config_value = execute_query_fetch_all(self.evadb, "SHOW OPENAIKEY") @@ -128,14 +128,6 @@ def test_show_config_execution(self): with self.assertRaises(Exception): execute_query_fetch_all(self.evadb, "SHOW BADCONFIG") - def test_show_all_configs(self): - show_all_config_value = execute_query_fetch_all(self.evadb, "SHOW CONFIGS") - - # NOTE :- Since the values of configs like the paths are not user/machine/installation agnostic, - # It doesn't make sense to test for the values. Hence, we are only testing for the keys - columns = show_all_config_value.columns - self.assertEqual(columns == list(BASE_EVADB_CONFIG.keys()), True) - # integration test def test_show_databases(self): result = execute_query_fetch_all(self.evadb, "SHOW DATABASES;") diff --git a/test/unit_tests/parser/test_parser.py b/test/unit_tests/parser/test_parser.py index 3091e8f3d0..6086db088e 100644 --- a/test/unit_tests/parser/test_parser.py +++ b/test/unit_tests/parser/test_parser.py @@ -905,7 +905,7 @@ def test_show_config_statement(self): show_config_stmt = evadb_statement_list[0] - expected_stmt = ShowStatement(show_type=ShowType.CONFIGS, show_val="OPENAIKEY") + expected_stmt = ShowStatement(show_type=ShowType.CONFIG, show_val="OPENAIKEY") self.assertEqual(show_config_stmt, expected_stmt)