当前位置: 首页>>代码示例>>Java>>正文


Java HadoopInput类代码示例

本文整理汇总了Java中org.apache.trevni.avro.HadoopInput的典型用法代码示例。如果您正苦于以下问题:Java HadoopInput类的具体用法?Java HadoopInput怎么用?Java HadoopInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HadoopInput类属于org.apache.trevni.avro包,在下文中一共展示了HadoopInput类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAvroSchema

import org.apache.trevni.avro.HadoopInput; //导入依赖的package包/类
@Override
public  Schema getAvroSchema(Path p, final Job job) throws IOException {

  FileSystem fs = FileSystem.get(p.toUri(), job.getConfiguration());
  FileStatus[] statusArray = fs.globStatus(p, VISIBLE_FILES);

  if (statusArray == null) {
    throw new IOException("Path " + p.toString() + " does not exist.");
  }
  
  if (statusArray.length == 0) {
    throw new IOException("No path matches pattern " + p.toString());
  }

  Path filePath = depthFirstSearchForFile(statusArray, fs);
  
  if (filePath == null) {
    throw new IOException("No path matches pattern " + p.toString());
  }

  AvroColumnReader.Params params =
      new AvroColumnReader.Params(
          new HadoopInput(filePath, job.getConfiguration()));
  AvroColumnReader<GenericData.Record> reader =
      new AvroColumnReader<GenericData.Record>(params);
  Schema s = reader.getFileSchema();
  reader.close();
  return s;
  }
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:30,代码来源:TrevniStorage.java

示例2: getAvroSchema

import org.apache.trevni.avro.HadoopInput; //导入依赖的package包/类
@Override
public  Schema getAvroSchema(Path p[], final Job job) throws IOException {

  ArrayList<FileStatus> statusList = new ArrayList<FileStatus>();
  FileSystem fs = FileSystem.get(p[0].toUri(), job.getConfiguration());
  for (Path temp : p) {
    for (FileStatus tempf : fs.globStatus(temp, Utils.VISIBLE_FILES)) {
      statusList.add(tempf);
    }
  }
  FileStatus[] statusArray = (FileStatus[]) statusList
      .toArray(new FileStatus[statusList.size()]);

  if (statusArray == null) {
    throw new IOException("Path " + p.toString() + " does not exist.");
  }
  
  if (statusArray.length == 0) {
    throw new IOException("No path matches pattern " + p.toString());
  }

  Path filePath = Utils.depthFirstSearchForFile(statusArray, fs);
  
  if (filePath == null) {
    throw new IOException("No path matches pattern " + p.toString());
  }

  AvroColumnReader.Params params =
      new AvroColumnReader.Params(
          new HadoopInput(filePath, job.getConfiguration()));
  AvroColumnReader<GenericData.Record> reader =
      new AvroColumnReader<GenericData.Record>(params);
  Schema s = reader.getFileSchema();
  reader.close();
  return s;
  }
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:37,代码来源:TrevniStorage.java

示例3: TrevniScanner

import org.apache.trevni.avro.HadoopInput; //导入依赖的package包/类
public TrevniScanner(Configuration conf, Schema schema, TableMeta meta, FileFragment fragment) throws IOException {
  super(conf, schema, meta, fragment);
  reader = new ColumnFileReader(new HadoopInput(fragment.getPath(), conf));
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:5,代码来源:TrevniScanner.java


注:本文中的org.apache.trevni.avro.HadoopInput类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。