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


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java:
##########
@@ -433,6 +437,20 @@ void setSnapshotSummary(Map<String, String> parameters, 
Snapshot currentSnapshot
     }
   }
 
+  private void setPartitionSpec(TableMetadata metadata, Map<String, String> 
parameters) {
+    parameters.remove(TableProperties.DEFAULT_PARTITION_SPEC);
+    if (metadata.spec() != null && metadata.spec().isPartitioned()) {
+      parameters.put(TableProperties.DEFAULT_PARTITION_SPEC, 
PartitionSpecParser.toJson(metadata.spec()));

Review Comment:
   `PartitionSpecParser.toJson()` doesn't convert a source column id to its 
name. Here is an example of a partition spec json string.
   ```
   
{"spec-id":0,"fields":[{"name":"data_bucket","transform":"bucket[16]","source-id":2,"field-id":1000}]}
   ```
   It only shows the source id(2),  the column name is `data` as the following 
code shows. It'd be more user-friendly if we show the column name.
   ```
       Schema schema = new Schema(
           required(1, "id", Types.IntegerType.get(), "unique ID"),
           required(2, "data", Types.StringType.get())
       );
       PartitionSpec spec = PartitionSpec.builderFor(schema)
           .bucket("data", 16)
           .build();
   ```



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