You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@paimon.apache.org by lz...@apache.org on 2024/04/13 07:15:25 UTC

(paimon-trino) branch main updated: Implement listDirectories in TrinoFileIO, reduce changes to call listFiles which is recursive (#66)

This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/paimon-trino.git


The following commit(s) were added to refs/heads/main by this push:
     new 2cb9213  Implement listDirectories in TrinoFileIO, reduce changes to call listFiles which is recursive (#66)
2cb9213 is described below

commit 2cb921375a75d22cb6fc79e7cc27bd6710c55a51
Author: YeJunHao <41...@users.noreply.github.com>
AuthorDate: Sat Apr 13 15:15:21 2024 +0800

    Implement listDirectories in TrinoFileIO, reduce changes to call listFiles which is recursive (#66)
---
 .../src/main/java/org/apache/paimon/trino/fileio/TrinoFileIO.java  | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/paimon-trino-common/src/main/java/org/apache/paimon/trino/fileio/TrinoFileIO.java b/paimon-trino-common/src/main/java/org/apache/paimon/trino/fileio/TrinoFileIO.java
index 3a5f676..6b74596 100644
--- a/paimon-trino-common/src/main/java/org/apache/paimon/trino/fileio/TrinoFileIO.java
+++ b/paimon-trino-common/src/main/java/org/apache/paimon/trino/fileio/TrinoFileIO.java
@@ -110,6 +110,13 @@ public class TrinoFileIO implements FileIO {
         return fileStatusList.toArray(new FileStatus[0]);
     }
 
+    @Override
+    public FileStatus[] listDirectories(Path path) throws IOException {
+        return trinoFileSystem.listDirectories(Location.of(path.toString())).stream()
+                .map(l -> new TrinoDirectoryFileStatus(new Path(l.toString())))
+                .toArray(FileStatus[]::new);
+    }
+
     @Override
     public boolean exists(Path path) throws IOException {
         return trinoFileSystem.directoryExists(Location.of(path.toString())).orElse(false)