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



##########
File path: api/src/main/java/org/apache/iceberg/types/TypeUtil.java
##########
@@ -151,10 +152,8 @@ public static Type assignFreshIds(Type type, NextID 
nextId) {
    * @return a structurally identical schema with new ids assigned by the 
nextId function
    */
   public static Schema assignFreshIds(Schema schema, NextID nextId) {
-    return new Schema(TypeUtil
-        .visit(schema.asStruct(), new AssignFreshIds(nextId))
-        .asNestedType()
-        .fields());
+    Types.StructType struct = TypeUtil.visit(schema.asStruct(), new 
AssignFreshIds(nextId)).asStructType();

Review comment:
       Yes, that was why I chose to just remove the fields not matched instead 
of throwing NPE,. but then I realized it dies not make sense. 
   
   For example, for a table schema with identifier `(id, catalog)`,  it does 
not really make sense to say that, when selecting the `id` field, the new 
schema has identifier `(id)`. So I don't think it the identifier fields should 
be added there.




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