本文整理汇总了Java中org.apache.hadoop.fs.FileSystem.getLength方法的典型用法代码示例。如果您正苦于以下问题:Java FileSystem.getLength方法的具体用法?Java FileSystem.getLength怎么用?Java FileSystem.getLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.fs.FileSystem
的用法示例。
在下文中一共展示了FileSystem.getLength方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRecordReader
import org.apache.hadoop.fs.FileSystem; //导入方法依赖的package包/类
@Override
public RecordReader<NullWritable,ColumnAndIndex> getRecordReader( final InputSplit split, final JobConf job, final Reporter reporter ) throws IOException {
FileSplit fileSplit = (FileSplit)split;
Path path = fileSplit.getPath();
FileSystem fs = path.getFileSystem( job );
long fileLength = fs.getLength( path );
long start = fileSplit.getStart();
long length = fileSplit.getLength();
InputStream in = fs.open( path );
IJobReporter jobReporter = new HadoopJobReporter( reporter );
jobReporter.setStatus( String.format( "Read file : %s" , path.toString() ) );
HiveReaderSetting hiveConfig = new HiveReaderSetting( fileSplit , job );
if ( hiveConfig.isVectorMode() ){
IVectorizedReaderSetting vectorizedSetting = new HiveVectorizedReaderSetting( fileSplit , job , hiveConfig );
return (RecordReader)new MDSHiveDirectVectorizedReader( in , fileLength , start , length , vectorizedSetting , jobReporter );
}
else{
return new MDSHiveLineReader( in , fileLength , start , length , hiveConfig , jobReporter , spreadCounter );
}
}
示例2: MDSCombineSpreadReader
import org.apache.hadoop.fs.FileSystem; //导入方法依赖的package包/类
public MDSCombineSpreadReader( final CombineFileSplit split , final TaskAttemptContext context , final Integer index ) throws IOException{
Configuration config = context.getConfiguration();
Path path = split.getPath( index );
FileSystem fs = path.getFileSystem( config );
long fileLength = fs.getLength( path );
InputStream in = fs.open( path );
innerReader = new MDSSpreadReader();
innerReader.setStream( in , fileLength , 0 , fileLength );
}
示例3: initialize
import org.apache.hadoop.fs.FileSystem; //导入方法依赖的package包/类
@Override
public void initialize( final InputSplit inputSplit, final TaskAttemptContext context ) throws IOException, InterruptedException {
FileSplit fileSplit = (FileSplit)inputSplit;
Configuration config = context.getConfiguration();
Path path = fileSplit.getPath();
FileSystem fs = path.getFileSystem( config );
long fileLength = fs.getLength( path );
long start = fileSplit.getStart();
long length = fileSplit.getLength();
InputStream in = fs.open( path );
}