Skip to content

Commit

Permalink
test(trino): test hive table overwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Aug 10, 2023
1 parent 0677f8d commit 914a9a3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions docker/trino/catalog/hive.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
connector.name=hive

hive.allow-drop-table=true
hive.allow-rename-table=true
hive.ignore-absent-partitions=true
hive.metastore.thrift.delete-files-on-drop=true
hive.metastore.uri=thrift://hive-metastore:9083
Expand Down
15 changes: 14 additions & 1 deletion ibis/backends/trino/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@pytest.fixture
def tmp_name(con):
name = ibis.util.gen_name("test_trino_table_properties")
name = ibis.util.gen_name("test_trino")
yield name
con.drop_table(name, force=True)

Expand All @@ -33,3 +33,16 @@ def test_table_properties(tmp_name):
ddl = c.exec_driver_sql(f"SHOW CREATE TABLE {tmp_name}").scalar()
assert "ORC" in ddl
assert "bucketed_by" in ddl


def test_hive_table_overwrite(tmp_name):
con = ibis.trino.connect(database="hive", schema="default")
schema = ibis.schema(dict(a="int"))

t = con.create_table(tmp_name, schema=schema)
assert tmp_name in con.list_tables()
assert t.schema() == schema

t = con.create_table(tmp_name, schema=schema, overwrite=True)
assert tmp_name in con.list_tables()
assert t.schema() == schema

0 comments on commit 914a9a3

Please sign in to comment.