Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
Fix length problem in dfs command
Browse files Browse the repository at this point in the history
  • Loading branch information
qiyuangong committed Oct 8, 2018
1 parent ae75e6f commit 0816267
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,16 @@ public FileStatus[] listStatus(Path p) throws IOException {
newStatus.add(status);
}
} else {
newStatus.add(status);
FileState fileState = smartDFSClient.getFileState(getPathName(status.getPath()));
if (fileState instanceof CompressionFileState) {
long len = ((CompressionFileState) fileState).getOriginalLength();
newStatus.add(new FileStatus(len, status.isDirectory(), status.getReplication(),
status.getBlockSize(), status.getModificationTime(), status.getAccessTime(),
status.getPermission(), status.getOwner(), status.getGroup(),
status.isSymlink() ? status.getSymlink() : null, status.getPath()));
} else {
newStatus.add(status);
}
}
}
return newStatus.toArray(new FileStatus[oldStatus.length]);
Expand Down Expand Up @@ -297,6 +306,12 @@ public FileStatus getFileLinkStatus(final Path f) throws IOException {
if (fileState instanceof CompactFileState) {
fileStatus = getFileStatus(target);
}
} else {
Path target = getLinkTarget(f);
FileState fileState = smartDFSClient.getFileState(getPathName(target));
if (fileState instanceof CompressionFileState) {
fileStatus = getFileStatus(target);
}
}
return fileStatus;
}
Expand Down

0 comments on commit 0816267

Please sign in to comment.