in src/main/java/org/apache/paimon/trino/fileio/TrinoFileIO.java [145:161]
public boolean delete(Path path, boolean recursive) throws IOException {
Location location = Location.of(path.toString());
if (trinoFileSystem.directoryExists(location).orElse(false)) {
if (!recursive) {
if (trinoFileSystem.listFiles(location).hasNext()) {
throw new IOException("Directory " + location + " is not empty");
}
}
trinoFileSystem.deleteDirectory(location);
return true;
} else if (existFile(location)) {
trinoFileSystem.deleteFile(location);
return true;
}
return false;
}