Skip to content

Commit

Permalink
bug: drop bug fix (#1165)
Browse files Browse the repository at this point in the history
Cannot reproduce the bug but added robust testcases. 

#1149 The inconsistent behavior might be happening because of another
bug where we were creating a table even if the select query failed. We
have fixed that, so it may fix this bug as well.
  • Loading branch information
gaurav274 committed Sep 21, 2023
1 parent 715a5bd commit 443510a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/integration_tests/long/test_create_table_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ def test_should_create_table_from_select(self):
expected_batch = Batch(frames=pd.DataFrame(expected))
self.assertEqual(actual_batch, expected_batch)

execute_query_fetch_all(self.evadb, "DROP TABLE IF EXISTS dummy_table;")

# re create table should work
execute_query_fetch_all(self.evadb, create_query)

@macos_skip_marker
@pytest.mark.torchtest
def test_should_create_table_from_select_lateral_join(self):
Expand All @@ -102,6 +107,12 @@ def test_should_create_table_from_select_lateral_join(self):
for idx in res.index:
self.assertTrue("car" in res["uadtrac_fastrcnn.label"][idx])

execute_query_fetch_all(self.evadb, "DROP TABLE IF EXISTS uadtrac_fastRCNN;")

# re create table should work
query = "CREATE TABLE IF NOT EXISTS " f"uadtrac_fastRCNN AS {select_query};"
execute_query_fetch_all(self.evadb, query)


if __name__ == "__main__":
unittest.main()
18 changes: 18 additions & 0 deletions test/integration_tests/short/test_drop_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ def test_should_drop_table(self):
self.evadb, drop_query, do_not_print_exceptions=True
)

# we should be able to re-create the table
execute_query_fetch_all(self.evadb, query)
# clean up
execute_query_fetch_all(self.evadb, drop_query)

def run_create_function_query(self):
create_function_query = """CREATE FUNCTION DummyObjectDetector
INPUT (Frame_Array NDARRAY UINT8(3, 256, 256))
Expand All @@ -136,6 +141,11 @@ def test_should_drop_function(self):
)
self.assertTrue(function is None)

# We should be able to re-create the function
self.run_create_function_query()
# clean up
execute_query_fetch_all(self.evadb, drop_query)

def test_drop_wrong_function_name(self):
self.run_create_function_query()
right_function_name = "DummyObjectDetector"
Expand Down Expand Up @@ -227,3 +237,11 @@ def test_should_drop_database(self):
f"DROP DATABASE {database_name}",
do_not_print_exceptions=True,
)

# We should be able to add the database again
execute_query_fetch_all(self.evadb, query)

# clean up
result = execute_query_fetch_all(
self.evadb, f"DROP DATABASE IF EXISTS {database_name}"
)

0 comments on commit 443510a

Please sign in to comment.