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


Java AvroJob.getMapOutputKeySchema方法代码示例

本文整理汇总了Java中org.apache.avro.mapreduce.AvroJob.getMapOutputKeySchema方法的典型用法代码示例。如果您正苦于以下问题:Java AvroJob.getMapOutputKeySchema方法的具体用法?Java AvroJob.getMapOutputKeySchema怎么用?Java AvroJob.getMapOutputKeySchema使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.avro.mapreduce.AvroJob的用法示例。


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

示例1: getRecordWriter

import org.apache.avro.mapreduce.AvroJob; //导入方法依赖的package包/类
@Override
public RecordWriter<Text, NullWritable> getRecordWriter(TaskAttemptContext job) throws IOException, InterruptedException {
    Configuration conf = job.getConfiguration();
    // Get the writer schema.
    Schema writerSchema = AvroJob.getOutputKeySchema(conf);
    boolean isMapOnly = job.getNumReduceTasks() == 0;
    if (isMapOnly) {
      Schema mapOutputSchema = AvroJob.getMapOutputKeySchema(conf);
      if (mapOutputSchema != null) {
        writerSchema = mapOutputSchema;
      }
    }
    if (null == writerSchema) {
      throw new IOException(
          "AvroKeyOutputFormat requires an output schema. Use AvroJob.setOutputKeySchema().");
    }
    
    GenericData dataModel = AvroSerialization.createDataModel(conf);

    return new PentahoAvroWrapperRecordWriter(writerSchema, dataModel, getCompressionCodec(job),
       getAvroFileOutputStream(job), getSyncInterval(job));
}
 
开发者ID:ITXpander,项目名称:hadoop-extensions,代码行数:23,代码来源:JsonToAvroOutputFormat.java

示例2: setup

import org.apache.avro.mapreduce.AvroJob; //导入方法依赖的package包/类
@Override
protected void setup(Context context) throws IOException, InterruptedException {
  keySchema = AvroJob.getMapOutputKeySchema(context.getConfiguration());
  outKey = new AvroKey<GenericRecord>();
  outKey.datum(new GenericData.Record(keySchema));
  outValue = new AvroValue<GenericRecord>();
}
 
开发者ID:Hanmourang,项目名称:Gobblin,代码行数:8,代码来源:AvroKeyMapper.java

示例3: setup

import org.apache.avro.mapreduce.AvroJob; //导入方法依赖的package包/类
@Override
protected void setup(Context context) throws IOException, InterruptedException {
  this.keySchema = AvroJob.getMapOutputKeySchema(context.getConfiguration());
  this.outKey = new AvroKey<>();
  this.outKey.datum(new GenericData.Record(this.keySchema));
  this.outValue = new AvroValue<>();
}
 
开发者ID:apache,项目名称:incubator-gobblin,代码行数:8,代码来源:AvroKeyMapper.java

示例4: setConf

import org.apache.avro.mapreduce.AvroJob; //导入方法依赖的package包/类
/** {@inheritDoc} */
        @Override
        public void setConf(Configuration conf) {
            super.setConf(conf);
            if (null != conf) {
                // The MapReduce framework will be using this comparator to sort AvroKey objects
                // output from the map phase, so use the schema defined for the map output key.
                mSchema = AvroJob.getMapOutputKeySchema(conf);

                fetcher = new ConfigFieldFetcher(conf, getConfigName());
                //System.out.println(getConfigName() + " fields: " + fetcher);

//                deserializer = new AvroKeyDeserializer(mSchema, mSchema, conf.getClassLoader());
            }
        }
 
开发者ID:alexholmes,项目名称:avro-sorting,代码行数:16,代码来源:AvroSort.java


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