Skip to content

Commit

Permalink
add ut
Browse files Browse the repository at this point in the history
  • Loading branch information
xuzifu666 committed Aug 15, 2024
1 parent 8a120bf commit b214a42
Showing 1 changed file with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,58 @@ public void testCreateExternalTable() throws Exception {
assertThat(tablePath.getFileSystem().exists(tablePath)).isTrue();
}

@Test
public void testCreateCatalogWithSyncTblProperties() throws Exception {
tEnv.executeSql(
String.join(
"\n",
"CREATE CATALOG paimon_catalog_sync WITH (",
" 'type' = 'paimon',",
" 'metastore' = 'hive',",
" 'uri' = '',",
" 'warehouse' = '" + path + "',",
" 'lock.enabled' = 'true',",
" 'table.type' = 'EXTERNAL',",
" 'sync-all-properties' = 'true'",
")"))
.await();
tEnv.executeSql("USE CATALOG paimon_catalog_sync").await();
tEnv.executeSql("USE test_db").await();
tEnv.executeSql("CREATE TABLE t01 ( aa INT, bb STRING ) WITH ( 'file.format' = 'avro' )")
.await();
// assert contain properties
assertThat(
hiveShell
.executeQuery("DESC FORMATTED t01")
.contains("\tfile.format \tavro "))
.isTrue();

tEnv.executeSql(
String.join(
"\n",
"CREATE CATALOG paimon_catalog_sync01 WITH (",
" 'type' = 'paimon',",
" 'metastore' = 'hive',",
" 'uri' = '',",
" 'warehouse' = '" + path + "',",
" 'lock.enabled' = 'true',",
" 'table.type' = 'EXTERNAL',",
" 'sync-all-properties' = 'false'",
")"))
.await();
tEnv.executeSql("USE CATALOG paimon_catalog_sync01").await();
tEnv.executeSql("USE test_db").await();
tEnv.executeSql("CREATE TABLE t02 ( aa INT, bb STRING ) WITH ( 'file.format' = 'avro' )")
.await();

// assert not contain properties
assertThat(
hiveShell
.executeQuery("DESC FORMATTED t02")
.contains("\tfile.format \tavro "))
.isFalse();
}

@Test
public void testCreateInsensitiveTable() throws Exception {
tEnv.executeSql(
Expand Down

0 comments on commit b214a42

Please sign in to comment.