[HUDI-1723] Fix path selector listing files with the same mod date (#2845)
This commit is contained in:
@@ -45,6 +45,8 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.attribute.FileTime;
|
||||
import java.time.Instant;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -224,6 +226,11 @@ public class FileCreateUtils {
|
||||
|
||||
public static void createBaseFile(String basePath, String partitionPath, String instantTime, String fileId, long length)
|
||||
throws Exception {
|
||||
createBaseFile(basePath, partitionPath, instantTime, fileId, length, Instant.now().toEpochMilli());
|
||||
}
|
||||
|
||||
public static void createBaseFile(String basePath, String partitionPath, String instantTime, String fileId, long length, long lastModificationTimeMilli)
|
||||
throws Exception {
|
||||
Path parentPath = Paths.get(basePath, partitionPath);
|
||||
Files.createDirectories(parentPath);
|
||||
Path baseFilePath = parentPath.resolve(baseFileName(instantTime, fileId));
|
||||
@@ -231,6 +238,7 @@ public class FileCreateUtils {
|
||||
Files.createFile(baseFilePath);
|
||||
}
|
||||
new RandomAccessFile(baseFilePath.toFile(), "rw").setLength(length);
|
||||
Files.setLastModifiedTime(baseFilePath, FileTime.fromMillis(lastModificationTimeMilli));
|
||||
}
|
||||
|
||||
public static void createLogFile(String basePath, String partitionPath, String instantTime, String fileId, int version)
|
||||
|
||||
Reference in New Issue
Block a user