ssdong commented on a change in pull request #2784:
URL: https://github.com/apache/hudi/pull/2784#discussion_r611068273
##########
File path:
hudi-common/src/test/java/org/apache/hudi/common/testutils/FileCreateUtils.java
##########
@@ -157,11 +157,19 @@ public static void createReplaceCommit(String basePath,
String instantTime, Hood
}
public static void createRequestedReplaceCommit(String basePath, String
instantTime, HoodieRequestedReplaceMetadata requestedReplaceMetadata) throws
IOException {
- createMetaFile(basePath, instantTime,
HoodieTimeline.REQUESTED_REPLACE_COMMIT_EXTENSION,
serializeRequestedReplaceMetadata(requestedReplaceMetadata).get());
+ if (null != requestedReplaceMetadata) {
+ createMetaFile(basePath, instantTime,
HoodieTimeline.REQUESTED_REPLACE_COMMIT_EXTENSION,
serializeRequestedReplaceMetadata(requestedReplaceMetadata).get());
+ } else {
+ createMetaFile(basePath, instantTime,
HoodieTimeline.REQUESTED_REPLACE_COMMIT_EXTENSION, new byte[0]);
+ }
}
- public static void createInflightReplaceCommit(String basePath, String
instantTime) throws IOException {
- createMetaFile(basePath, instantTime,
HoodieTimeline.INFLIGHT_REPLACE_COMMIT_EXTENSION);
+ public static void createInflightReplaceCommit(String basePath, String
instantTime, HoodieCommitMetadata inflightReplaceMetadata) throws IOException {
+ if (inflightReplaceMetadata != null) {
+ createMetaFile(basePath, instantTime,
HoodieTimeline.INFLIGHT_REPLACE_COMMIT_EXTENSION,
inflightReplaceMetadata.toJsonString().getBytes(StandardCharsets.UTF_8));
+ } else {
+ createMetaFile(basePath, instantTime,
HoodieTimeline.INFLIGHT_REPLACE_COMMIT_EXTENSION);
+ }
Review comment:
Both requested and inflight commit files can be empty and non-empty
under existing implementations so we wanna test them both in the unit tests.
--
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]