Skip to content

Commit

Permalink
JDBC: JDBC Catalog should do exact namespace search for get namespace…
Browse files Browse the repository at this point in the history
… queries
  • Loading branch information
amogh-jahagirdar committed Oct 14, 2023
1 parent b5ea0d5 commit c81ca64
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/org/apache/iceberg/jdbc/JdbcUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ final class JdbcUtil {
+ CATALOG_NAME
+ " = ? AND "
+ TABLE_NAMESPACE
+ " LIKE ? LIMIT 1";
+ " = ? LIMIT 1";
static final String LIST_NAMESPACES_SQL =
"SELECT DISTINCT "
+ TABLE_NAMESPACE
Expand Down Expand Up @@ -205,7 +205,7 @@ final class JdbcUtil {
+ CATALOG_NAME
+ " = ? AND "
+ NAMESPACE_NAME
+ " LIKE ? LIMIT 1";
+ " = ? LIMIT 1";
static final String INSERT_NAMESPACE_PROPERTIES_SQL =
"INSERT INTO "
+ NAMESPACE_PROPERTIES_TABLE_NAME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,13 @@ public void testNamespaceExists() {
assertThat(catalog.namespaceExists(Namespace.of("db", "db2", "not_exist")))
.as("Should false to namespace doesn't exist")
.isFalse();

Lists.newArrayList(TableIdentifier.of("ns", "t1"), TableIdentifier.of("ns_1", "t1"))
.forEach(t -> catalog.createTable(t, SCHEMA, PartitionSpec.unpartitioned()));
catalog.dropTable(TableIdentifier.of("ns", "t1"));
catalog.dropNamespace(Namespace.of("ns"));
assertThat(catalog.namespaceExists(Namespace.of("ns"))).isFalse();
assertThat(catalog.namespaceExists(Namespace.of("ns_1"))).isTrue();
}

@Test
Expand Down

0 comments on commit c81ca64

Please sign in to comment.