jackye1995 commented on a change in pull request #2556:
URL: https://github.com/apache/iceberg/pull/2556#discussion_r629064200



##########
File path: api/src/main/java/org/apache/iceberg/types/TypeUtil.java
##########
@@ -181,10 +183,24 @@ public static Schema assignFreshIds(int schemaId, Schema 
schema, NextID nextId)
    * @return a structurally identical schema with new ids assigned by the 
nextId function
    */
   public static Schema assignFreshIds(Schema schema, Schema baseSchema, NextID 
nextId) {
-    return new Schema(TypeUtil
-        .visit(schema.asStruct(), new AssignFreshIds(schema, baseSchema, 
nextId))
-        .asNestedType()
-        .fields());
+    Types.StructType freshSchemaStruct = TypeUtil

Review comment:
       @openinx so after reading the code a bit more, I think it does not make 
sense to convert alias in the methods. The reason is that, as the documentation 
suggests:
   
   > Alias maps are created when translating an external schema, like an Avro 
Schema, to this format. The original column names can be provided in a Map when 
constructing this Schema.
   
   So this happens in methods such as `AvroSchemaUtil.toIceberg`, 
`ParquetSchemaUtil.convert`, etc. However, these alias are never persisted in 
the actual table metadata. As a proof, the `TypeUtil.assignFreshIds` is called 
for every table metadata replacement, but the alias is never passed in. So 
changing the method to pass in the alias is a change of behavior and we should 
not do that. So I think the current implementation should be good enough, I 
will add a few tests based on what you and Yan suggested.




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

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