ajantha-bhat commented on code in PR #10186:
URL: https://github.com/apache/iceberg/pull/10186#discussion_r1595087423
##########
kafka-connect/kafka-connect/src/test/java/org/apache/iceberg/connect/data/IcebergWriterFactoryTest.java:
##########
@@ -83,4 +90,26 @@ public void testAutoCreateTable(boolean partitioned) {
assertThat(specCaptor.getValue().isPartitioned()).isEqualTo(partitioned);
assertThat(propsCaptor.getValue()).containsKey("test-prop");
}
+
+ @Test
+ public void testNamespaceCreation() throws IOException {
+ TableIdentifier tableIdentifier =
+ TableIdentifier.of(Namespace.of("foo1", "foo2", "foo3"), "bar");
+ Schema schema = new Schema(Types.NestedField.required(1, "id",
Types.StringType.get()));
+
+ try (InMemoryCatalog catalog = new InMemoryCatalog()) {
Review Comment:
done. Updated the existing testcase
##########
kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/data/IcebergWriterFactory.java:
##########
@@ -112,4 +118,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);
Review Comment:
done.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]