You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/01/30 23:25:32 UTC

[GitHub] [iceberg] rdblue commented on a change in pull request #4011: Allow table defaults to be configured and/ or enforced at catalog level using catalog properties.

rdblue commented on a change in pull request #4011:
URL: https://github.com/apache/iceberg/pull/4011#discussion_r795267170



##########
File path: api/src/main/java/org/apache/iceberg/catalog/Catalog.java
##########
@@ -388,6 +392,59 @@ default TableBuilder buildTable(TableIdentifier identifier, Schema schema) {
   default void initialize(String name, Map<String, String> properties) {
   }
 
+  /**
+   * Get catalog properties.
+   *
+   * @return catalog properties
+   */
+  Map<String, String> properties();
+
+  /**
+   * Get default table properties set at Catalog level through catalog properties.
+   *
+   * @return default table properties specified in catalog properties
+   */
+  default Map<String, String> tableCreateDefaultProperties() {
+    String tableCreateDefaultPrefix = "table.create.default.";
+    Map<String, String> props = properties() == null ? Collections.emptyMap() : properties();
+
+    return props.entrySet().stream()
+        .filter(e -> e.getKey().toLowerCase(Locale.ROOT).startsWith(tableCreateDefaultPrefix))
+        .collect(Collectors.toMap(e -> e.getKey().replace(tableCreateDefaultPrefix, ""),
+            Map.Entry::getValue));
+  }
+
+  /**
+   * Get table properties that are enforced at Catalog level through catalog properties.
+   *
+   * @return default table properties enforced through catalog properties
+   */
+  default Map<String, String> tableCreateEnforcedProperties() {
+    String tableCreateEnforcedPrefix = "table.create.enforced.";

Review comment:
       I think we need a better name for this. This is really long and will be embedded in nested configs (for Spark) and will contain nested configs.




-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org