Skip to content

Commit

Permalink
test namespace for SparkUnifiedCatalog
Browse files Browse the repository at this point in the history
  • Loading branch information
MarigWeizhi committed Dec 17, 2024
1 parent 1c0e574 commit 85d811f
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public void testTableFormats(TableFormat format, boolean sessionCatalog) {
long count = sql(sqlText).count();
Assertions.assertEquals(expect, count);

// create and drop namespace
testNamespaceWithSql();

// visit sub tables.
testVisitSubTable(format, sessionCatalog);

Expand All @@ -108,6 +111,17 @@ public void testTableFormats(TableFormat format, boolean sessionCatalog) {
Assertions.assertFalse(unifiedCatalog().tableExists(target().database, target().table));
}

private void testNamespaceWithSql() {
// Use SparkTestBase::sql method to test SparkUnifiedCatalog instead of CommonUnifiedCatalog.
String createDatabase = "CREATE DATABASE test_unified_catalog";
sql(createDatabase);
Assertions.assertTrue(unifiedCatalog().databaseExists("test_unified_catalog"));

String dropDatabase = "DROP DATABASE test_unified_catalog";
sql(dropDatabase);
Assertions.assertFalse(unifiedCatalog().databaseExists("test_unified_catalog"));
}

private String pkDDL(TableFormat format) {
if (TableFormat.MIXED_HIVE.equals(format) || TableFormat.MIXED_ICEBERG.equals(format)) {
return ", primary key(id)";
Expand Down

0 comments on commit 85d811f

Please sign in to comment.