Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions paimon-common/src/main/java/org/apache/paimon/fs/FileIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ default void setRuntimeContext(Map<String, String> options) {}
*/
PositionOutputStream newOutputStream(Path path, boolean overwrite) throws IOException;

/**
* Whether {@link #newOutputStream(Path, boolean)} with {@code overwrite=false} can create this
* path without first listing or probing the parent directory, and can fail atomically if the
* object already exists.
*/
default boolean supportsAtomicCreateWithoutOverwrite(Path path) throws IOException {
return false;
}

/**
* Opens a TwoPhaseOutputStream at the indicated Path for transactional writing.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ public PositionOutputStream newOutputStream(Path path, boolean overwrite) throws
return wrap(() -> fileIO(path).newOutputStream(path, overwrite));
}

@Override
public boolean supportsAtomicCreateWithoutOverwrite(Path path) throws IOException {
return wrap(() -> fileIO(path).supportsAtomicCreateWithoutOverwrite(path));
}

@Override
public FileStatus getFileStatus(Path path) throws IOException {
return wrap(() -> fileIO(path).getFileStatus(path));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ public PositionOutputStream newOutputStream(Path path, boolean overwrite) throws
return wrap(() -> fileIO(path).newOutputStream(path, overwrite));
}

@Override
public boolean supportsAtomicCreateWithoutOverwrite(Path path) throws IOException {
return wrap(() -> fileIO(path).supportsAtomicCreateWithoutOverwrite(path));
}

@Override
public FileStatus getFileStatus(Path path) throws IOException {
return wrap(() -> fileIO(path).getFileStatus(path));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ public PositionOutputStream newOutputStream(Path path, boolean overwrite) throws
return delegate.newOutputStream(path, overwrite);
}

@Override
public boolean supportsAtomicCreateWithoutOverwrite(Path path) throws IOException {
return delegate.supportsAtomicCreateWithoutOverwrite(path);
}

@Override
public FileStatus getFileStatus(Path path) throws IOException {
return delegate.getFileStatus(path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ public PositionOutputStream newOutputStream(Path path, boolean overwrite) throws
return fileIO().newOutputStream(path, overwrite);
}

@Override
public boolean supportsAtomicCreateWithoutOverwrite(Path path) throws IOException {
return fileIO().supportsAtomicCreateWithoutOverwrite(path);
}

@Override
public TwoPhaseOutputStream newTwoPhaseOutputStream(Path path, boolean overwrite)
throws IOException {
Expand Down
Loading
Loading