From 5587d005b1815a8c50daf4e75965d25007e7d988 Mon Sep 17 00:00:00 2001 From: Tai Le Manh Date: Thu, 22 Aug 2024 18:08:49 +0700 Subject: [PATCH] Fix java fmt checkstyle Signed-off-by: Tai Le Manh --- .../kernel/internal/DeltaHistoryManager.java | 10 +++---- .../internal/checkpoints/Checkpointer.java | 3 +- .../internal/snapshot/SnapshotManager.java | 29 +++++++------------ 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/kernel/kernel-api/src/main/java/io/delta/kernel/internal/DeltaHistoryManager.java b/kernel/kernel-api/src/main/java/io/delta/kernel/internal/DeltaHistoryManager.java index b38573f063..58d55fea11 100644 --- a/kernel/kernel-api/src/main/java/io/delta/kernel/internal/DeltaHistoryManager.java +++ b/kernel/kernel-api/src/main/java/io/delta/kernel/internal/DeltaHistoryManager.java @@ -91,11 +91,11 @@ public static long getEarliestRecreatableCommit(Engine engine, Path logPath) throws TableNotFoundException { try (CloseableIterator files = listFrom(engine, logPath, 0) - .filter(fs -> { - final Path path = new Path(fs.getPath()); - return FileNames.isCommitFile(path) - || FileNames.isCheckpointFile(path); - })) { + .filter( + fs -> { + final Path path = new Path(fs.getPath()); + return FileNames.isCommitFile(path) || FileNames.isCheckpointFile(path); + })) { if (!files.hasNext()) { // listFrom already throws an error if the directory is truly empty, thus this must // be because no files are checkpoint or delta files diff --git a/kernel/kernel-api/src/main/java/io/delta/kernel/internal/checkpoints/Checkpointer.java b/kernel/kernel-api/src/main/java/io/delta/kernel/internal/checkpoints/Checkpointer.java index 52d99cd4f8..c19bbdf82c 100644 --- a/kernel/kernel-api/src/main/java/io/delta/kernel/internal/checkpoints/Checkpointer.java +++ b/kernel/kernel-api/src/main/java/io/delta/kernel/internal/checkpoints/Checkpointer.java @@ -162,8 +162,7 @@ public static Optional findLastCompleteCheckpointBefore( } private static boolean validCheckpointFile(FileStatus fileStatus) { - return FileNames.isCheckpointFile(new Path(fileStatus.getPath())) - && fileStatus.getSize() > 0; + return FileNames.isCheckpointFile(new Path(fileStatus.getPath())) && fileStatus.getSize() > 0; } /** The path to the file that holds metadata about the most recent checkpoint. */ diff --git a/kernel/kernel-api/src/main/java/io/delta/kernel/internal/snapshot/SnapshotManager.java b/kernel/kernel-api/src/main/java/io/delta/kernel/internal/snapshot/SnapshotManager.java index 1bd70d951f..0262c34901 100644 --- a/kernel/kernel-api/src/main/java/io/delta/kernel/internal/snapshot/SnapshotManager.java +++ b/kernel/kernel-api/src/main/java/io/delta/kernel/internal/snapshot/SnapshotManager.java @@ -220,8 +220,7 @@ public void checkpoint(Engine engine, long version) throws TableNotFoundExceptio Checkpointer checkpointer = new Checkpointer(logPath); checkpointer.writeLastCheckpointFile(engine, checkpointMetaData); - logger.info("{}: Last checkpoint metadata file is written for version: {}", - tablePath, version); + logger.info("{}: Last checkpoint metadata file is written for version: {}", tablePath, version); logger.info("{}: Finished checkpoint for version: {}", tablePath, version); } @@ -250,8 +249,7 @@ private CloseableIterator listFrom(Engine engine, long startVersion) throws IOException { logger.debug("{}: startVersion: {}", tablePath, startVersion); return wrapEngineExceptionThrowsIO( - () -> engine.getFileSystemClient() - .listFrom(FileNames.listingPrefix(logPath, startVersion)), + () -> engine.getFileSystemClient().listFrom(FileNames.listingPrefix(logPath, startVersion)), "Listing from %s", FileNames.listingPrefix(logPath, startVersion)); } @@ -272,8 +270,7 @@ private boolean isDeltaCommitOrCheckpointFile(Path filePath) { * Returns an iterator containing a list of files found in the _delta_log directory starting with * the startVersion. Returns None if no files are found or the directory is missing. */ - private Optional> listFromOrNone( - Engine engine, long startVersion) { + private Optional> listFromOrNone(Engine engine, long startVersion) { // LIST the directory, starting from the provided lower bound (treat missing dir as empty). // NOTE: "empty/missing" is _NOT_ equivalent to "contains no useful commit files." try { @@ -327,11 +324,10 @@ protected final Optional> listDeltaAndCheckpointFiles( Optional versionToLoad, Optional tableCommitHandlerOpt) { versionToLoad.ifPresent( - v -> checkArgument( - v >= startVersion, - format("versionToLoad=%s provided is less than startVersion=%s", v, startVersion) - ) - ); + v -> + checkArgument( + v >= startVersion, + format("versionToLoad=%s provided is less than startVersion=%s", v, startVersion))); logger.debug( "startVersion: {}, versionToLoad: {}, coordinated commits enabled: {}", startVersion, @@ -391,8 +387,7 @@ protected final Optional> listDeltaAndCheckpointFiles( if (FileNames.isCommitFile(filePath)) { maxDeltaVersionSeen.set( Math.max( - maxDeltaVersionSeen.get(), - FileNames.deltaVersion(fileStatus.getPath()))); + maxDeltaVersionSeen.get(), FileNames.deltaVersion(fileStatus.getPath()))); } output.add(fileStatus); } @@ -428,7 +423,7 @@ private List getUnbackfilledCommits( .map( commitCoordinatorClientHandler -> { logger.info( - "Getting un-backfilled commits from commit coordinator for " + "table: {}", + "Getting un-backfilled commits from commit coordinator for table: {}", tablePath); return commitCoordinatorClientHandler .getCommits(startVersion, versionToLoad.orElse(null)) @@ -665,8 +660,7 @@ protected Optional getLogSegmentAtOrBeforeVersion( Tuple2, List> checkpointsAndDeltas = ListUtils.partition( - newFiles, - fileStatus -> FileNames.isCheckpointFile(new Path(fileStatus.getPath()))); + newFiles, fileStatus -> FileNames.isCheckpointFile(new Path(fileStatus.getPath()))); final List checkpoints = checkpointsAndDeltas._1; final List deltas = checkpointsAndDeltas._2; @@ -759,8 +753,7 @@ protected Optional getLogSegmentAtOrBeforeVersion( .collect(Collectors.toCollection(LinkedList::new)); logDebug( - () -> - format("deltaVersions: %s", Arrays.toString(deltaVersionsAfterCheckpoint.toArray()))); + () -> format("deltaVersions: %s", Arrays.toString(deltaVersionsAfterCheckpoint.toArray()))); final long newVersion = deltaVersionsAfterCheckpoint.isEmpty()