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


Java AvroJob.getOutputKeySchema方法代码示例

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


在下文中一共展示了AvroJob.getOutputKeySchema方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getRecordWriter

import org.apache.avro.mapreduce.AvroJob; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public RecordWriter<AvroKey<K>, V> getRecordWriter(TaskAttemptContext context)
        throws IOException {
    // Get the writer schema.
    Schema writerSchema = AvroJob.getOutputKeySchema(context.getConfiguration());

    if (null == writerSchema)
        throw new IOException(NodesOutputFormat.class.getName() + " requires an output schema. Use AvroJob.setOutputKeySchema().");

    return this.recordWriterFactory.create(writerSchema, getCompressionCodec(context),
            getAvroFileOutputStream(context));
}
 
开发者ID:pasqualesalza,项目名称:elephant56,代码行数:14,代码来源:NodesOutputFormat.java

示例3: getRecordWriter

import org.apache.avro.mapreduce.AvroJob; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
@SuppressWarnings("unchecked")
public RecordWriter<AvroKey<T>, NullWritable> getRecordWriter(TaskAttemptContext context)
    throws IOException {
  // Get the writer schema.
  Schema writerSchema = AvroJob.getOutputKeySchema(context.getConfiguration());
  if (null == writerSchema) {
    throw new IOException(
        "AvroKeyOutputFormat requires an output schema. Use AvroJob.setOutputKeySchema().");
  }

  return mRecordWriterFactory.create(
      writerSchema, getCompressionCodec(context), getAvroFileOutputStream(context), context.getConfiguration());
}
 
开发者ID:apache,项目名称:incubator-datafu,代码行数:16,代码来源:AvroKeyWithMetadataOutputFormat.java

示例4: setup

import org.apache.avro.mapreduce.AvroJob; //导入方法依赖的package包/类
@Override
protected void setup(Context context) throws IOException,
        InterruptedException
{
    Configuration conf = context.getConfiguration();
    Schema keySchema = AvroJob.getOutputKeySchema(conf);

    record = new Record(keySchema);
}
 
开发者ID:svemuri,项目名称:CalcEngine,代码行数:10,代码来源:GenerateDictionary.java

示例5: setup

import org.apache.avro.mapreduce.AvroJob; //导入方法依赖的package包/类
@Override protected void setup(
        Context context)
        throws IOException, InterruptedException {
    avroSchema = AvroJob.getOutputKeySchema(context.getConfiguration());

    cfMetaData = CFMetadataUtility.initializeCfMetaData(context.getConfiguration());
    cfDef = cfMetaData.getCfDef();
    initBuilder();

    /* This exporter assumes tables are composite, which should be true of all current schemas */
    if (!cfDef.isComposite) throw new RuntimeException("Only can export composite CQL table schemas.");
}
 
开发者ID:Netflix,项目名称:aegisthus,代码行数:13,代码来源:CQLMapper.java


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