singhpk234 commented on code in PR #4546:
URL: https://github.com/apache/iceberg/pull/4546#discussion_r857161554


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java:
##########
@@ -433,6 +439,38 @@ void setSnapshotSummary(Map<String, String> parameters, 
Snapshot currentSnapshot
     }
   }
 
+  private void setSchema(TableMetadata metadata, Map<String, String> 
parameters) {
+    parameters.remove(TableProperties.CURRENT_SCHEMA);
+    if (metadata.schema() != null) {
+      String schema = SchemaParser.toJson(metadata.schema());
+      setField(parameters, TableProperties.CURRENT_SCHEMA, schema);
+    }
+  }
+
+  private void setPartitionSpec(TableMetadata metadata, Map<String, String> 
parameters) {
+    parameters.remove(TableProperties.DEFAULT_PARTITION_SPEC);
+    if (metadata.spec() != null && metadata.spec().isPartitioned()) {
+      String spec = PartitionSpecParser.toJson(metadata.spec());
+      setField(parameters, TableProperties.DEFAULT_PARTITION_SPEC, spec);
+    }
+  }
+
+  private void setSortOrder(TableMetadata metadata, Map<String, String> 
parameters) {
+    parameters.remove(TableProperties.DEFAULT_SORT_ORDER);
+    if (metadata.sortOrder() != null && metadata.sortOrder().isSorted()) {
+      String sortOrder = SortOrderParser.toJson(metadata.sortOrder());
+      setField(parameters, TableProperties.DEFAULT_SORT_ORDER, sortOrder);
+    }
+  }
+
+  private void setField(Map<String, String> parameters, String key, String 
value) {
+    if (value.length() <= maxHiveTablePropertySize) {
+      parameters.put(key, value);
+    } else {
+      LOG.warn("Not exposing {} in HMS since it exceeds {} characters", key, 
maxHiveTablePropertySize);
+    }

Review Comment:
   [nit] should we make this : 
   
   
https://github.com/apache/iceberg/blob/449a7438b83c475d4bf15e41a5c7aa0021ca0b0c/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java#L425-L430
   
   also use this setter



-- 
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]

Reply via email to