You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2015/07/14 04:43:18 UTC
incubator-kylin git commit: minor,
fix FileNotFoundException in FileTable.getSignature()
Repository: incubator-kylin
Updated Branches:
refs/heads/0.7-staging 1c4ab4fea -> 7264d8aed
minor, fix FileNotFoundException in FileTable.getSignature()
Project: http://git-wip-us.apache.org/repos/asf/incubator-kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kylin/commit/7264d8ae
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/7264d8ae
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/7264d8ae
Branch: refs/heads/0.7-staging
Commit: 7264d8aed6e3416b67a56fff5e9543fe26f94cf4
Parents: 1c4ab4f
Author: Li, Yang <ya...@ebay.com>
Authored: Tue Jul 14 10:43:06 2015 +0800
Committer: Li, Yang <ya...@ebay.com>
Committed: Tue Jul 14 10:43:06 2015 +0800
----------------------------------------------------------------------
.../org/apache/kylin/dict/lookup/FileTable.java | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/7264d8ae/dictionary/src/main/java/org/apache/kylin/dict/lookup/FileTable.java
----------------------------------------------------------------------
diff --git a/dictionary/src/main/java/org/apache/kylin/dict/lookup/FileTable.java b/dictionary/src/main/java/org/apache/kylin/dict/lookup/FileTable.java
index 1e9b1e8..99da892 100644
--- a/dictionary/src/main/java/org/apache/kylin/dict/lookup/FileTable.java
+++ b/dictionary/src/main/java/org/apache/kylin/dict/lookup/FileTable.java
@@ -18,6 +18,7 @@
package org.apache.kylin.dict.lookup;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -58,18 +59,22 @@ public class FileTable implements ReadableTable {
@Override
public TableSignature getSignature() throws IOException {
- Pair<Long, Long> sizeAndLastModified = getSizeAndLastModified(path);
- return new TableSignature(path, sizeAndLastModified.getFirst(), sizeAndLastModified.getSecond());
+ try {
+ Pair<Long, Long> sizeAndLastModified = getSizeAndLastModified(path);
+ return new TableSignature(path, sizeAndLastModified.getFirst(), sizeAndLastModified.getSecond());
+ } catch (FileNotFoundException ex) {
+ return null;
+ }
}
@Override
public String toString() {
return path;
}
-
+
public static Pair<Long, Long> getSizeAndLastModified(String path) throws IOException {
FileSystem fs = HadoopUtil.getFileSystem(path);
-
+
// get all contained files if path is directory
ArrayList<FileStatus> allFiles = new ArrayList<>();
FileStatus status = fs.getFileStatus(new Path(path));
@@ -79,14 +84,14 @@ public class FileTable implements ReadableTable {
FileStatus[] listStatus = fs.listStatus(new Path(path));
allFiles.addAll(Arrays.asList(listStatus));
}
-
+
long size = 0;
long lastModified = 0;
for (FileStatus file : allFiles) {
size += file.getLen();
lastModified = Math.max(lastModified, file.getModificationTime());
}
-
+
return new Pair<Long, Long>(size, lastModified);
}
}