rajarshisarkar commented on code in PR #4011:
URL: https://github.com/apache/iceberg/pull/4011#discussion_r873381989
##########
aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogTable.java:
##########
@@ -368,4 +369,54 @@ public void testColumnCommentsAndParameters() {
);
Assert.assertEquals("Columns do not match", expectedColumns,
actualColumns);
}
+
+ @Test
+ public void testTablePropsDefinedAtCatalogLevel() {
+ String namespace = createNamespace();
+ String tableName = getRandomName();
+ TableIdentifier tableIdent = TableIdentifier.of(namespace, tableName);
+ ImmutableMap<String, String> catalogProps = ImmutableMap.of(
+ "table-default.key1", "catalog-default-key1",
+ "table-default.key2", "catalog-default-key2",
+ "table-default.key3", "catalog-default-key3",
+ "table-override.key3", "catalog-override-key3",
+ "table-override.key4", "catalog-override-key4",
+ "warehouse", "s3://" + testBucketName + "/" + testPathPrefix);
+
+ glueCatalog.initialize("glue", catalogProps);
+
+ Schema schema = new Schema(
+ NestedField.required(3, "id", Types.IntegerType.get(), "unique ID"),
+ NestedField.required(4, "data", Types.StringType.get())
+ );
+
+ org.apache.iceberg.Table table = glueCatalog.buildTable(tableIdent, schema)
+ .withProperty("key2", "table-key2")
+ .withProperty("key3", "table-key3")
+ .withProperty("key5", "table-key5")
+ .create();
+
+ Assert.assertEquals(
+ "Table defaults set for the catalog must be added to the table
properties.",
+ "catalog-default-key1",
+ table.properties().get("key1"));
+ Assert.assertEquals(
+ "Table property must override table default properties set at catalog
level.",
+ "table-key2",
+ table.properties().get("key2"));
+ Assert.assertEquals(
+ "Table property override set at catalog level must override table
default" +
+ " properties set at catalog level and table property specified.",
+ "catalog-override-key3",
+ table.properties().get("key3"));
+ Assert.assertEquals(
+ "Table override not in table props or defaults should be added to
table properties",
+ "catalog-override-key4",
+ table.properties().get("key4"));
+ Assert.assertEquals(
+ "Table properties without any catalog level default or override should
be added to table" +
+ " properties.",
+ "table-key5",
+ table.properties().get("key5"));
+ }
Review Comment:
Currently in `TestGlueCatalog` we mock objects of `GlueCatalog` and
`GlueClient`. The class is mainly used for creating/listing/dropping/renaming
namespace/tables by mocking the response. Also, it looks like we cannot mock
other clients in ` S3FileIO` directly without refactoring. Do let me know your
thoughts.
--
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]