ajantha-bhat commented on code in PR #10186: URL: https://github.com/apache/iceberg/pull/10186#discussion_r1575543923
########## kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/data/IcebergWriterFactory.java: ########## @@ -112,4 +117,18 @@ Table autoCreateTable(String tableName, SinkRecord sample) { }); return result.get(); } + + @VisibleForTesting + static void createNamespaceIfNotExist(Catalog catalog, Namespace identifierNamespace) { + String[] levels = identifierNamespace.levels(); + for (int index = 0; index < levels.length; index++) { + Namespace namespace = Namespace.of(Arrays.copyOfRange(levels, 0, index + 1)); + try { + ((SupportsNamespaces) catalog).createNamespace(namespace); + } catch (AlreadyExistsException ex) { Review Comment: I assumed if the auto create table is enabled, means user has permission to create tables. So, They can create Namespaces also. But that assumptions can be wrong for some catalogs. Let me catch `ForbiddenException` also for ignoring it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org