beyond1920 commented on code in PR #10426:
URL: https://github.com/apache/hudi/pull/10426#discussion_r1438956162


##########
hudi-common/src/main/java/org/apache/hudi/common/table/TableSchemaResolver.java:
##########
@@ -257,6 +259,8 @@ private Option<Schema> 
getTableSchemaFromCommitMetadata(HoodieInstant instant, b
       Schema schema = new Schema.Parser().parse(existingSchemaStr);
       if (includeMetadataFields) {
         schema = HoodieAvroUtils.addMetadataFields(schema, 
hasOperationField.get());
+      } else {
+        schema = HoodieAvroUtils.removeMetadataFields(schema);

Review Comment:
   After alter table schema like 
   `alter table t1 drop f_date`, `alter table t1 add f_long bigint`, the schema 
of alter schema instant would contain metadata fields.
   If not remove those metadata fields, the subsequent insert query would throw 
following exception
   ![Kim 2024-01-01 
114124](https://github.com/apache/hudi/assets/1525333/1df0f2d1-9e2d-47e1-b809-ae044b9b36cc)
   And the subsequent query like 'select *' would including metadata columns, 
the behavior is not consistent with  the previous behavior.
   



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

Reply via email to