From 598264f33ee1b06b81948eee27910a0bf283cb90 Mon Sep 17 00:00:00 2001 From: affan00733 Date: Tue, 19 Sep 2023 02:18:10 +0530 Subject: [PATCH 1/7] added exception msg --- .gitignore | 2 ++ evadb/executor/load_executor.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 1a091b989..20b2caed7 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ __pycache__/ # C extensions *.so +# virtutal env +test_evadb_venv/ # Distribution / packaging .Python diff --git a/evadb/executor/load_executor.py b/evadb/executor/load_executor.py index 254465c1a..4a947da47 100644 --- a/evadb/executor/load_executor.py +++ b/evadb/executor/load_executor.py @@ -18,7 +18,7 @@ from evadb.executor.load_multimedia_executor import LoadMultimediaExecutor from evadb.parser.types import FileFormatType from evadb.plan_nodes.load_data_plan import LoadDataPlan - +from evadb.executor.executor_utils import ExecutorError class LoadDataExecutor(AbstractExecutor): def __init__(self, db: EvaDBDatabase, node: LoadDataPlan): @@ -30,6 +30,9 @@ def exec(self, *args, **kwargs): """ # invoke the appropriate executor + if self.node.file_options["file_format"] == None: + err_msg = f"Invalid file format, please use supported file formats: CSV | VIDEO | IMAGE | DOCUMENT | PDF" + raise ExecutorError(err_msg) if self.node.file_options["file_format"] in [ FileFormatType.VIDEO, FileFormatType.IMAGE, From 2830548f91ece89b6b79f558323b67ed69b064c0 Mon Sep 17 00:00:00 2001 From: affan00733 Date: Tue, 19 Sep 2023 02:20:38 +0530 Subject: [PATCH 2/7] linter changes --- evadb/executor/load_executor.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/evadb/executor/load_executor.py b/evadb/executor/load_executor.py index 4a947da47..c90c7ccec 100644 --- a/evadb/executor/load_executor.py +++ b/evadb/executor/load_executor.py @@ -14,11 +14,12 @@ # limitations under the License. from evadb.database import EvaDBDatabase from evadb.executor.abstract_executor import AbstractExecutor +from evadb.executor.executor_utils import ExecutorError from evadb.executor.load_csv_executor import LoadCSVExecutor from evadb.executor.load_multimedia_executor import LoadMultimediaExecutor from evadb.parser.types import FileFormatType from evadb.plan_nodes.load_data_plan import LoadDataPlan -from evadb.executor.executor_utils import ExecutorError + class LoadDataExecutor(AbstractExecutor): def __init__(self, db: EvaDBDatabase, node: LoadDataPlan): @@ -30,8 +31,8 @@ def exec(self, *args, **kwargs): """ # invoke the appropriate executor - if self.node.file_options["file_format"] == None: - err_msg = f"Invalid file format, please use supported file formats: CSV | VIDEO | IMAGE | DOCUMENT | PDF" + if self.node.file_options["file_format"] is None: + err_msg = "Invalid file format, please use supported file formats: CSV | VIDEO | IMAGE | DOCUMENT | PDF" raise ExecutorError(err_msg) if self.node.file_options["file_format"] in [ FileFormatType.VIDEO, From 9fadced5be57381633d80fdf3ef1bb39dcb68fe7 Mon Sep 17 00:00:00 2001 From: affan00733 Date: Wed, 20 Sep 2023 00:46:30 +0530 Subject: [PATCH 3/7] load query testcase added --- test/integration_tests/long/test_load_executor.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/integration_tests/long/test_load_executor.py b/test/integration_tests/long/test_load_executor.py index c7e486b84..91117577e 100644 --- a/test/integration_tests/long/test_load_executor.py +++ b/test/integration_tests/long/test_load_executor.py @@ -40,7 +40,7 @@ from evadb.models.storage.batch import Batch from evadb.parser.types import FileFormatType from evadb.server.command_handler import execute_query_fetch_all - +from evadb.executor.executor_utils import ExecutorError @pytest.mark.notparallel class LoadExecutorTests(unittest.TestCase): @@ -500,6 +500,15 @@ def test_load_pdfs(self): self.assertEqual(len(result.columns), 4) self.assertEqual(len(result), 26) + + def test_load_query_incorrect_fileFormat(self): + try: + execute_query_fetch_all( + self.evadb, + f"""LOAD document '{EvaDB_ROOT_DIR}/data/documents/*.pdf' INTO pdfs;""", + ) + except ExecutorError as e: + print(e) if __name__ == "__main__": unittest.main() From eff3efc578ab1fd96769b5974fa5e8c66d14176a Mon Sep 17 00:00:00 2001 From: affan00733 Date: Wed, 20 Sep 2023 00:48:07 +0530 Subject: [PATCH 4/7] load query testcase added --- test/integration_tests/long/test_load_executor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/integration_tests/long/test_load_executor.py b/test/integration_tests/long/test_load_executor.py index 91117577e..eac720501 100644 --- a/test/integration_tests/long/test_load_executor.py +++ b/test/integration_tests/long/test_load_executor.py @@ -40,7 +40,7 @@ from evadb.models.storage.batch import Batch from evadb.parser.types import FileFormatType from evadb.server.command_handler import execute_query_fetch_all -from evadb.executor.executor_utils import ExecutorError +from pprint import pprint @pytest.mark.notparallel class LoadExecutorTests(unittest.TestCase): @@ -500,7 +500,6 @@ def test_load_pdfs(self): self.assertEqual(len(result.columns), 4) self.assertEqual(len(result), 26) - def test_load_query_incorrect_fileFormat(self): try: execute_query_fetch_all( @@ -508,7 +507,8 @@ def test_load_query_incorrect_fileFormat(self): f"""LOAD document '{EvaDB_ROOT_DIR}/data/documents/*.pdf' INTO pdfs;""", ) except ExecutorError as e: - print(e) + pprint(e) + if __name__ == "__main__": unittest.main() From 09ca7f1411f292d686cd871ca279fc5addc51706 Mon Sep 17 00:00:00 2001 From: affan00733 Date: Wed, 20 Sep 2023 00:48:50 +0530 Subject: [PATCH 5/7] load query testcase added --- test/integration_tests/long/test_load_executor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/integration_tests/long/test_load_executor.py b/test/integration_tests/long/test_load_executor.py index eac720501..89c9c3109 100644 --- a/test/integration_tests/long/test_load_executor.py +++ b/test/integration_tests/long/test_load_executor.py @@ -19,6 +19,7 @@ import tempfile import unittest from pathlib import Path +from pprint import pprint from test.util import ( create_dummy_batches, create_dummy_csv_batches, @@ -40,7 +41,7 @@ from evadb.models.storage.batch import Batch from evadb.parser.types import FileFormatType from evadb.server.command_handler import execute_query_fetch_all -from pprint import pprint + @pytest.mark.notparallel class LoadExecutorTests(unittest.TestCase): From cf8e20be5f68b45d8060b932afa3a1d05be08130 Mon Sep 17 00:00:00 2001 From: affan00733 Date: Wed, 20 Sep 2023 00:50:04 +0530 Subject: [PATCH 6/7] load query testcase added --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index 20b2caed7..1a091b989 100644 --- a/.gitignore +++ b/.gitignore @@ -7,8 +7,6 @@ __pycache__/ # C extensions *.so -# virtutal env -test_evadb_venv/ # Distribution / packaging .Python From 38e9d21cd56907b2d5ecf1847c96433441044ac3 Mon Sep 17 00:00:00 2001 From: affan00733 Date: Wed, 20 Sep 2023 02:38:11 +0530 Subject: [PATCH 7/7] load query testcase changed with assertraise --- test/integration_tests/long/test_load_executor.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/integration_tests/long/test_load_executor.py b/test/integration_tests/long/test_load_executor.py index 89c9c3109..05a479a8f 100644 --- a/test/integration_tests/long/test_load_executor.py +++ b/test/integration_tests/long/test_load_executor.py @@ -19,7 +19,6 @@ import tempfile import unittest from pathlib import Path -from pprint import pprint from test.util import ( create_dummy_batches, create_dummy_csv_batches, @@ -502,13 +501,11 @@ def test_load_pdfs(self): self.assertEqual(len(result), 26) def test_load_query_incorrect_fileFormat(self): - try: + with self.assertRaises(ExecutorError): execute_query_fetch_all( self.evadb, f"""LOAD document '{EvaDB_ROOT_DIR}/data/documents/*.pdf' INTO pdfs;""", ) - except ExecutorError as e: - pprint(e) if __name__ == "__main__":