danny0405 commented on code in PR #18988:
URL: https://github.com/apache/hudi/pull/18988#discussion_r3679456946
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/callback/common/HoodieWriteCommitCallbackMessage.java:
##########
@@ -69,10 +74,102 @@ public class HoodieWriteCommitCallbackMessage implements
Serializable {
*/
private final Option<Map<String, String>> extraMetadata;
+ /**
+ * Previous base file paths keyed by fileId, resolved lazily. Populated by
the write
+ * client from the cached FileSystemView so that callback implementations
don't have to
+ * rebuild a view. Empty for inserts and for callers that don't pre-resolve.
+ *
+ * <p>Resolution is deferred until the first {@link #getPrevFilePaths()}
call: a callback
+ * that never reads the previous paths pays nothing (no FileSystemView
access). Transient
+ * because the initializer may capture a FileSystemView (not serializable);
the resolved
+ * map is what crosses Java serialization (see {@link #writeObject}/{@link
#readObject}).
+ * Excluded from the generated getters so the {@link Lazy} wrapper never
leaks into JSON.
+ */
+ @Getter(AccessLevel.NONE)
+ private transient Lazy<Map<String, PrevFilePaths>> prevFilePaths;
+
+ /**
+ * Free-form context that producers can attach for downstream callback
consumers.
+ * The OSS write client populates this as empty; specialized callsites or
wrappers
+ * may populate it with whatever context their callbacks need.
+ */
+ private final Map<String, String> extraContext;
+
+ public HoodieWriteCommitCallbackMessage(String commitTime,
+ String tableName,
+ String basePath,
+ List<HoodieWriteStat>
hoodieWriteStat,
+ Option<String> commitActionType,
+ Option<Map<String, String>>
extraMetadata,
+ Supplier<Map<String, PrevFilePaths>>
prevFilePathsSupplier,
Review Comment:
could we just pass aroud a supplier of the file system view, and triggers
the `prevFilePaths` computation lazily since the `hoodieWriteStat` is alreay
here, so that we can get rid of the cusmization for the Java Ser/De.
--
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]