From 59a993a15691fd3305ad5334db524aae3be4ebec Mon Sep 17 00:00:00 2001 From: fanng Date: Tue, 9 Jul 2024 15:47:39 +0800 Subject: [PATCH] fix comment --- .../integration/test/IcebergRESTServiceIT.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/iceberg-rest-server/src/test/java/com/datastrato/gravitino/iceberg/integration/test/IcebergRESTServiceIT.java b/iceberg-rest-server/src/test/java/com/datastrato/gravitino/iceberg/integration/test/IcebergRESTServiceIT.java index df11d43f0fd..9dfb3936b87 100644 --- a/iceberg-rest-server/src/test/java/com/datastrato/gravitino/iceberg/integration/test/IcebergRESTServiceIT.java +++ b/iceberg-rest-server/src/test/java/com/datastrato/gravitino/iceberg/integration/test/IcebergRESTServiceIT.java @@ -46,6 +46,7 @@ public abstract class IcebergRESTServiceIT extends IcebergRESTServiceBaseIT { private static final String ICEBERG_REST_NS_PREFIX = "iceberg_rest_"; + private static final String ICEBERG_REGISTER_TABLE_NAME = "register_foo1"; @BeforeAll void prepareSQLContext() { @@ -66,7 +67,10 @@ private void purgeTable(String namespace, String table) { private void purgeNameSpace(String namespace) { Set tables = convertToStringSet(sql("SHOW TABLES IN " + namespace), 1); - tables.forEach(table -> purgeTable(namespace, table)); + tables.stream().filter( + // the original table and registered table share one metadata, so couldn't purge two tables. + table -> !table.equals(ICEBERG_REGISTER_TABLE_NAME)) + .forEach(table -> purgeTable(namespace, table)); sql("DROP database " + namespace); } @@ -525,14 +529,16 @@ void testSnapshot() { @EnabledIf("catalogTypeNotMemory") void testRegisterTable() { sql( - "CREATE TABLE iceberg_rest_table_test.register_foo1" - + "(id bigint COMMENT 'unique id',data string) using iceberg"); - sql(" INSERT INTO iceberg_rest_table_test.register_foo1 VALUES (1, 'a')"); + "CREATE TABLE iceberg_rest_table_test." + ICEBERG_REGISTER_TABLE_NAME + + " (id bigint COMMENT 'unique id',data string) using iceberg"); + sql(String.format("INSERT INTO iceberg_rest_table_test.%s VALUES (1, 'a')", + ICEBERG_REGISTER_TABLE_NAME)); // get metadata location List metadataLocations = convertToStringList( - sql("select file from iceberg_rest_table_test.register_foo1.metadata_log_entries"), 0); + sql(String.format("select file from iceberg_rest_table_test.%s.metadata_log_entries", + ICEBERG_REGISTER_TABLE_NAME)), 0); String metadataLocation = metadataLocations.get(metadataLocations.size() - 1); // register table