本文整理汇总了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));
}
示例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>();
}
示例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<>();
}
示例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());
}
}