hudi-agent commented on code in PR #18885:
URL: https://github.com/apache/hudi/pull/18885#discussion_r3427489950


##########
hudi-common/src/main/java/org/apache/hudi/common/util/CommitUtils.java:
##########
@@ -94,8 +92,7 @@ public static HoodieCommitMetadata 
buildMetadata(List<HoodieWriteStat> writeStat
     if (extraMetadata.isPresent()) {
       extraMetadata.get().forEach(commitMetadata::addMetadata);
     }
-    commitMetadata.addMetadata(HoodieCommitMetadata.SCHEMA_KEY, 
(schemaToStoreInCommit == null || schemaToStoreInCommit.equals(NULL_SCHEMA_STR))
-        ? "" : schemaToStoreInCommit);
+    commitMetadata.addMetadata(HoodieCommitMetadata.SCHEMA_KEY, 
schemaToStoreInCommit);

Review Comment:
   🤖 I think this drops a behavior that existed on master: previously 
`SCHEMA_KEY` was set to `""` when `schemaToStoreInCommit` was null or equal to 
`HoodieSchema.NULL_SCHEMA.toString()` ("\"null\""). Now `"\"null\""` is 
persisted verbatim, which is non-empty, so 
`getLastCommitMetadataWithValidSchema` no longer filters it out and 
`TableSchemaResolver.getTableSchema(false)` returns `NULL_SCHEMA` instead of 
throwing `HoodieSchemaNotFoundException`. I believe this regresses 
`TestHoodieClientMultiWriter.testHoodieClientWithSchemaConflictResolution` for 
the `createEmptyInitialCommit=true` cases (the DeltaStreamer empty-checkpoint 
commit scenario at line 311 sets `writeConfig22.setSchema("\"null\"")` and 
asserts the resolver throws). Could you re-add the null/NULL_SCHEMA-to-empty 
conversion here, or move that check into `removeMetadataFieldsFromSchema`?
   
   <sub><i>- AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



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