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