本文整理汇总了Java中org.apache.avro.mapreduce.AvroJob.getInputKeySchema方法的典型用法代码示例。如果您正苦于以下问题:Java AvroJob.getInputKeySchema方法的具体用法?Java AvroJob.getInputKeySchema怎么用?Java AvroJob.getInputKeySchema使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.avro.mapreduce.AvroJob
的用法示例。
在下文中一共展示了AvroJob.getInputKeySchema方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRecordReader
import org.apache.avro.mapreduce.AvroJob; //导入方法依赖的package包/类
@Override
public RecordReader<AvroKey<K>, AvroValue<V>> createRecordReader(
InputSplit split, TaskAttemptContext context)
throws IOException, InterruptedException {
Schema keyReaderSchema = AvroJob.getInputKeySchema(context.getConfiguration());
if (null == keyReaderSchema) {
LOG.warn("Key reader schema was not set. " +
"Use AvroJob.setInputKeySchema() if desired.");
LOG.info("Using a key reader schema equal to the writer schema.");
}
Schema valueReaderSchema = AvroJob.getInputValueSchema(context.getConfiguration());
if (null == valueReaderSchema) {
LOG.warn("Value reader schema was not set. " +
"Use AvroJob.setInputValueSchema() if desired.");
LOG.info("Using a value reader schema equal to the writer schema.");
}
return new AvroKeyValueRecordReader<K, V>(keyReaderSchema, valueReaderSchema);
}
示例2: createRecordReader
import org.apache.avro.mapreduce.AvroJob; //导入方法依赖的package包/类
@Override
public RecordReader<AvroKey<T>, NullWritable> createRecordReader(InputSplit inputSplit, TaskAttemptContext taskAttemptContext) throws IOException, InterruptedException {
Schema readerSchema = AvroJob.getInputKeySchema(taskAttemptContext.getConfiguration());
if(null == readerSchema) {
LOG.warn("Reader schema was not set. Use AvroJob.setInputKeySchema() if desired.");
}
return new ErrorHandlingAvroKeyRecordReader(readerSchema);
}
示例3: DelegatingAvroRecordReader
import org.apache.avro.mapreduce.AvroJob; //导入方法依赖的package包/类
public DelegatingAvroRecordReader(CombineFileSplit split,
TaskAttemptContext context, Integer splitIndex) {
Schema readerSchema = AvroJob.getInputKeySchema(context.getConfiguration());
if (null == readerSchema) {
logger().warn("Reader schema was not set. Use AvroJob.setInputKeySchema() if desired.");
logger().info("Using a reader schema equal to the writer schema.");
}
this.splitIndex = splitIndex;
delegate = new AvroKeyRecordReaderSkipBad<>(readerSchema);
}
示例4: createRecordReader
import org.apache.avro.mapreduce.AvroJob; //导入方法依赖的package包/类
@Override
public RecordReader<AvroKey<T>, NullWritable> createRecordReader(
InputSplit split, TaskAttemptContext context)
throws IOException, InterruptedException {
Schema readerSchema = AvroJob.getInputKeySchema(context.getConfiguration());
if (null == readerSchema) {
LOG.warn("Reader schema was not set. Use AvroJob.setInputKeySchema() if desired.");
LOG.info("Using a reader schema equal to the writer schema.");
LOG.info("Using GenericRecords instead of SpecificRecords.");
}
return new AvroKeyRecordReader<T>(readerSchema);
}
示例5: createRecordReader
import org.apache.avro.mapreduce.AvroJob; //导入方法依赖的package包/类
@Override
public RecordReader<Text, Text> createRecordReader(
InputSplit split, TaskAttemptContext context) throws IOException,
InterruptedException {
Schema readerSchema = AvroJob.getInputKeySchema(context.getConfiguration());
return new AvroBatchRecordReader<T>(readerSchema);
}
示例6: getSchema
import org.apache.avro.mapreduce.AvroJob; //导入方法依赖的package包/类
private static Schema getSchema(CombineFileSplit split, TaskAttemptContext cx, Integer idx) throws IOException {
Schema schema = AvroJob.getInputKeySchema(cx.getConfiguration());
if (schema != null) {
return schema;
}
Path path = split.getPath(idx);
FileSystem fs = path.getFileSystem(cx.getConfiguration());
return AvroUtils.getSchemaFromDataFile(path, fs);
}
示例7: createRecordReader
import org.apache.avro.mapreduce.AvroJob; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public RecordReader<AvroKey<T>, NullWritable> createRecordReader(InputSplit inputSplit,
TaskAttemptContext context) throws IOException
{
Schema readerSchema = AvroJob.getInputKeySchema(context.getConfiguration());
if (null == readerSchema) {
LOG.warn("Reader schema was not set. Use AvroJob.setInputKeySchema() if desired.");
LOG.info("Using a reader schema equal to the writer schema.");
}
Object c = CombinedAvroKeyRecordReader.class;
return new CombineFileRecordReader<AvroKey<T>, NullWritable>((CombineFileSplit) inputSplit, context, (Class<? extends RecordReader<AvroKey<T>, NullWritable>>)c);
}
示例8: AvroKeyCombineFileRecordReader
import org.apache.avro.mapreduce.AvroJob; //导入方法依赖的package包/类
public AvroKeyCombineFileRecordReader(CombineFileSplit split, TaskAttemptContext cx, Integer idx) {
this(split, AvroJob.getInputKeySchema(cx.getConfiguration()), idx);
}
示例9: CombinedAvroKeyRecordReader
import org.apache.avro.mapreduce.AvroJob; //导入方法依赖的package包/类
public CombinedAvroKeyRecordReader(CombineFileSplit inputSplit, TaskAttemptContext context, Integer idx)
{
super(AvroJob.getInputKeySchema(context.getConfiguration()));
this.inputSplit = inputSplit;
this.idx = idx;
}