From 97174a1797befa1cc01329c68c36fe1605fb9024 Mon Sep 17 00:00:00 2001 From: Chris Riccomini Date: Tue, 19 Dec 2023 13:57:08 -0800 Subject: [PATCH] Set parameter to true --- tests/integration/test_metastore.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/integration/test_metastore.py b/tests/integration/test_metastore.py index 7eae201..7168bfe 100644 --- a/tests/integration/test_metastore.py +++ b/tests/integration/test_metastore.py @@ -135,7 +135,9 @@ def setup_data(hive_client): retention=0, sd=storage_desc, partitionKeys=partition_keys, - parameters={}, + # We have to manually set the EXTERNAL parameter to TRUE, otherwise the + # metastore returns tableType=None. See https://github.com/recap-build/pymetastore/issues/37. + parameters={"EXTERNAL": "TRUE"}, tableType="EXTERNAL_TABLE", ) @@ -192,7 +194,9 @@ def setup_data(hive_client): retention=0, sd=storage_desc, partitionKeys=partition_keys, - parameters={}, + # We have to manually set the EXTERNAL parameter to TRUE, otherwise the + # metastore returns tableType=None. See https://github.com/recap-build/pymetastore/issues/37. + parameters={"EXTERNAL": "TRUE"}, tableType="EXTERNAL_TABLE", ) @@ -231,7 +235,9 @@ def setup_data(hive_client): retention=0, sd=storage_desc, partitionKeys=partition_keys, - parameters={}, + # We have to manually set the EXTERNAL parameter to TRUE, otherwise the + # metastore returns tableType=None. See https://github.com/recap-build/pymetastore/issues/37. + parameters={"EXTERNAL": "TRUE"}, tableType="EXTERNAL_TABLE", ) @@ -269,7 +275,9 @@ def setup_data(hive_client): retention=0, sd=storage_desc, partitionKeys=partition_keys, - parameters={}, + # We have to manually set the EXTERNAL parameter to TRUE, otherwise the + # metastore returns tableType=None. See https://github.com/recap-build/pymetastore/issues/37. + parameters={"EXTERNAL": "TRUE"}, tableType="EXTERNAL_TABLE", ) @@ -425,13 +433,6 @@ def test_get_table(hive_client): assert len(table.parameters) == 1 # this is not a parameter of the table we created, but the metastore adds it assert table.parameters.get("transient_lastDdlTime") is not None - # This assertion fails, I leave it here on purpose. My current assumption is that - # the metastore overrides some of the passed options with defaults. "MANAGEd_TABLE" - # is the default value for tableType. See here for the defaults: - # https://github.com/apache/hive/blob/14a1f70607db5ae6cf71b6d4343f308a5167581c/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/client/builder/TableBuilder.java#L69C43-L69C43 - # Something similar happens also when you choose a "VIRTUAL_VIEW" table type, where - # the metastore overrides the storage descriptor removing in the location the file:: - # prefix. assert table.table_type == "EXTERNAL_TABLE"