Skip to content

Commit

Permalink
Set parameter to true
Browse files Browse the repository at this point in the history
  • Loading branch information
criccomini committed Dec 19, 2023
1 parent e539b8b commit 97174a1
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions tests/integration/test_metastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)

Expand Down Expand Up @@ -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",
)

Expand Down Expand Up @@ -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",
)

Expand Down Expand Up @@ -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",
)

Expand Down Expand Up @@ -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"


Expand Down

0 comments on commit 97174a1

Please sign in to comment.