You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by xi...@apache.org on 2021/01/19 18:52:23 UTC

[incubator-pinot] branch master updated: Fixing pinot hadoop fs isDirectory method (#6461)

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

xiangfu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 60c802c  Fixing pinot hadoop fs isDirectory method (#6461)
60c802c is described below

commit 60c802c019b80141d4b2009627752469279d65c1
Author: Xiang Fu <fx...@gmail.com>
AuthorDate: Tue Jan 19 10:51:40 2021 -0800

    Fixing pinot hadoop fs isDirectory method (#6461)
---
 .../org/apache/pinot/plugin/filesystem/HadoopPinotFS.java   | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/pinot-plugins/pinot-file-system/pinot-hdfs/src/main/java/org/apache/pinot/plugin/filesystem/HadoopPinotFS.java b/pinot-plugins/pinot-file-system/pinot-hdfs/src/main/java/org/apache/pinot/plugin/filesystem/HadoopPinotFS.java
index 4024929..16b880c 100644
--- a/pinot-plugins/pinot-file-system/pinot-hdfs/src/main/java/org/apache/pinot/plugin/filesystem/HadoopPinotFS.java
+++ b/pinot-plugins/pinot-file-system/pinot-hdfs/src/main/java/org/apache/pinot/plugin/filesystem/HadoopPinotFS.java
@@ -136,7 +136,7 @@ public class HadoopPinotFS extends PinotFS {
   @Override
   public long length(URI fileUri)
       throws IOException {
-    return _hadoopFS.getLength(new Path(fileUri));
+    return _hadoopFS.getFileStatus(new Path(fileUri)).getLen();
   }
 
   @Override
@@ -202,9 +202,12 @@ public class HadoopPinotFS extends PinotFS {
 
   @Override
   public boolean isDirectory(URI uri) {
-    FileStatus fileStatus = new FileStatus();
-    fileStatus.setPath(new Path(uri));
-    return fileStatus.isDirectory();
+    try {
+      return _hadoopFS.getFileStatus(new Path(uri)).isDirectory();
+    } catch (IOException e) {
+      LOGGER.error("Could not get file status for {}", uri, e);
+      throw new RuntimeException(e);
+    }
   }
 
   @Override
@@ -212,7 +215,7 @@ public class HadoopPinotFS extends PinotFS {
     try {
       return _hadoopFS.getFileStatus(new Path(uri)).getModificationTime();
     } catch (IOException e) {
-      LOGGER.error("Could not get file status for {}", uri);
+      LOGGER.error("Could not get file status for {}", uri, e);
       throw new RuntimeException(e);
     }
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org