本文整理汇总了Java中org.apache.pig.impl.util.Utils.getPathLength方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.getPathLength方法的具体用法?Java Utils.getPathLength怎么用?Java Utils.getPathLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.pig.impl.util.Utils
的用法示例。
在下文中一共展示了Utils.getPathLength方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInputSizeInBytes
import org.apache.pig.impl.util.Utils; //导入方法依赖的package包/类
private Long getInputSizeInBytes() throws IOException {
if (loc == null) {
return 0L;
}
long inputBytes = 0L;
for (String location : getPathStrings(loc)) {
Path path = new Path(location);
FileSystem fs = path.getFileSystem(new Configuration());
FileStatus[] status = fs.globStatus(path);
if (status != null) {
for (FileStatus s : status) {
inputBytes += Utils.getPathLength(fs, s);
}
}
}
return inputBytes;
}
示例2: getTotalInputFileSize
import org.apache.pig.impl.util.Utils; //导入方法依赖的package包/类
/**
* Get the input size for as many inputs as possible. Inputs that do not report
* their size nor can pig look that up itself are excluded from this size.
*/
static long getTotalInputFileSize(Configuration conf,
List<POLoad> lds, Job job) throws IOException {
long totalInputFileSize = 0;
boolean foundSize = false;
for (POLoad ld : lds) {
long size = getInputSizeFromLoader(ld, job);
if (size > -1) { foundSize = true; }
if (size > 0) {
totalInputFileSize += size;
continue;
}
// the input file location might be a list of comma separated files,
// separate them out
for (String location : LoadFunc.getPathStrings(ld.getLFile().getFileName())) {
if (UriUtil.isHDFSFileOrLocalOrS3N(location)) {
Path path = new Path(location);
FileSystem fs = path.getFileSystem(conf);
FileStatus[] status = fs.globStatus(path);
if (status != null) {
for (FileStatus s : status) {
totalInputFileSize += Utils.getPathLength(fs, s);
foundSize = true;
}
}
}
}
}
return foundSize ? totalInputFileSize : -1;
}