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


Java AvroGenericRecordWritable类代码示例

本文整理汇总了Java中org.apache.hadoop.hive.serde2.avro.AvroGenericRecordWritable的典型用法代码示例。如果您正苦于以下问题:Java AvroGenericRecordWritable类的具体用法?Java AvroGenericRecordWritable怎么用?Java AvroGenericRecordWritable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AvroGenericRecordWritable类属于org.apache.hadoop.hive.serde2.avro包,在下文中一共展示了AvroGenericRecordWritable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: map

import org.apache.hadoop.hive.serde2.avro.AvroGenericRecordWritable; //导入依赖的package包/类
@Override
protected void map(RecordKey key, AvroGenericRecordWritable value,
                   org.apache.hadoop.mapreduce.Mapper<RecordKey, AvroGenericRecordWritable, RecordKey, AvroValue<Record>>.Context
                     context)
  throws IOException, InterruptedException {
  if (key.isValid()) {
    key.setHash(recordValue.hashCode());
    recordWrapped.datum((Record) value.getRecord());
    context.write(recordKey, recordWrapped);
  } else {
    context.getCounter(RecordCounter.RECORDS).increment(1);
    context.getCounter(RecordCounter.RECORDS_MALFORMED).increment(1);
    textValue.set(key.getSource());
    string.setLength(0);
    multipleOutputs.write(OUTPUT_TEXT, NullWritable.get(), textValue,
      string.append(MALFORMED_PATH_PREFIX).append(key.getBatch()).toString());
  }
}
 
开发者ID:ggear,项目名称:cloudera-framework,代码行数:19,代码来源:Partition.java

示例2: decode

import org.apache.hadoop.hive.serde2.avro.AvroGenericRecordWritable; //导入依赖的package包/类
public AvroGenericRecordWritable decode(byte[] payload) {
	try {
		MessageDecoderHelper helper = new MessageDecoderHelper(registry,
				topicName, payload).invoke();
     DatumReader<Record> reader = new GenericDatumReader<Record>(helper.getTargetSchema());

     log.debug("Trying to read kafka payload");
     log.debug("buffer: " + helper.getBuffer());
     log.debug("start: " + helper.getStart());
     log.debug("length: " + helper.getLength());
     log.debug("target schema: " + helper.getTargetSchema());
     log.debug("schema: " + helper.getSchema());
	  GenericRecord record = reader.read(null, decoderFactory.binaryDecoder(helper.getBuffer().array(),
         helper.getStart(), helper.getLength(), null));
     log.debug("Read kafka payload as " + record);

     AvroGenericRecordWritable grw = new AvroGenericRecordWritable(record);
     grw.setFileSchema(latestSchema);

     return grw;

	} catch (IOException e) {
		throw new MessageDecoderException(e);
	}
}
 
开发者ID:HiveKa,项目名称:HiveKa,代码行数:26,代码来源:KafkaAvroMessageDecoder.java

示例3: getRecordSequenceInputFormat

import org.apache.hadoop.hive.serde2.avro.AvroGenericRecordWritable; //导入依赖的package包/类
/**
 * Get a {@link SequenceFileInputFormat} from a <code>type</code>
 *
 * @param type the type to lookup
 * @return the {@link SequenceFileInputFormat} instance
 */
public static Class<? extends SequenceFileInputFormat<RecordKey, AvroGenericRecordWritable>> getRecordSequenceInputFormat(String type)
  throws IOException {
  if (!RECORD_INPUT_FORMATS.containsKey(type)) {
    throw new IOException("Could not find [RecordSequenceInputFormat] for type [" + type + "]");
  }
  return RECORD_INPUT_FORMATS.get(type);
}
 
开发者ID:ggear,项目名称:cloudera-framework,代码行数:14,代码来源:RecordFactory.java

示例4: setup

import org.apache.hadoop.hive.serde2.avro.AvroGenericRecordWritable; //导入依赖的package包/类
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
protected void setup(
  org.apache.hadoop.mapreduce.Mapper<RecordKey, AvroGenericRecordWritable, RecordKey, AvroValue<Record>>.Context context)
  throws IOException, InterruptedException {
  multipleOutputs = new MultipleOutputs(context);
}
 
开发者ID:ggear,项目名称:cloudera-framework,代码行数:8,代码来源:Partition.java

示例5: getWrappedRecord

import org.apache.hadoop.hive.serde2.avro.AvroGenericRecordWritable; //导入依赖的package包/类
private AvroGenericRecordWritable getWrappedRecord(String topicName, byte[] payload) throws IOException {
  AvroGenericRecordWritable r = null;
  try {
    r = decoder.decode(payload);
  } catch (Exception e) {
    if (!skipSchemaErrors) {
      throw new IOException(e);
    }
  }
  return r;
}
 
开发者ID:HiveKa,项目名称:HiveKa,代码行数:12,代码来源:KafkaRecordReader.java

示例6: convertRecord

import org.apache.hadoop.hive.serde2.avro.AvroGenericRecordWritable; //导入依赖的package包/类
@Override
public Iterable<AvroGenericRecordWritable> convertRecord(Schema outputSchema, GenericRecord inputRecord,
    WorkUnitState workUnit) throws DataConversionException {
  AvroGenericRecordWritable avroWritable = new AvroGenericRecordWritable();
  avroWritable.setRecord(inputRecord);
  avroWritable.setFileSchema(outputSchema);
  avroWritable.setRecordReaderID(this.uid);
  return Lists.newArrayList(avroWritable);
}
 
开发者ID:apache,项目名称:incubator-gobblin,代码行数:10,代码来源:AvroRecordToAvroWritableConverter.java

示例7: getCurrentValue

import org.apache.hadoop.hive.serde2.avro.AvroGenericRecordWritable; //导入依赖的package包/类
@Override
public AvroGenericRecordWritable getCurrentValue() throws IOException, InterruptedException {
  return recordWriteable;
}
 
开发者ID:ggear,项目名称:cloudera-framework,代码行数:5,代码来源:RecordTextReader.java

示例8: createRecordReader

import org.apache.hadoop.hive.serde2.avro.AvroGenericRecordWritable; //导入依赖的package包/类
@Override
public RecordReader<RecordKey, AvroGenericRecordWritable> createRecordReader(InputSplit split, TaskAttemptContext context)
  throws IOException {
  return new RecordReaderTextCsv(split, context);
}
 
开发者ID:ggear,项目名称:cloudera-framework,代码行数:6,代码来源:RecordTextInputFormatCsv.java

示例9: createRecordReader

import org.apache.hadoop.hive.serde2.avro.AvroGenericRecordWritable; //导入依赖的package包/类
@Override
public RecordReader<RecordKey, AvroGenericRecordWritable> createRecordReader(InputSplit split, TaskAttemptContext context)
  throws IOException {
  return new RecordReaderSequenceCsv();
}
 
开发者ID:ggear,项目名称:cloudera-framework,代码行数:6,代码来源:RecordSequenceInputFormatCsv.java

示例10: createRecordReader

import org.apache.hadoop.hive.serde2.avro.AvroGenericRecordWritable; //导入依赖的package包/类
@Override
public RecordReader<RecordKey, AvroGenericRecordWritable> createRecordReader(InputSplit split, TaskAttemptContext context)
  throws IOException {
  return new RecordReaderSequenceXml();
}
 
开发者ID:ggear,项目名称:cloudera-framework,代码行数:6,代码来源:RecordSequenceInputFormatXml.java

示例11: createRecordReader

import org.apache.hadoop.hive.serde2.avro.AvroGenericRecordWritable; //导入依赖的package包/类
@Override
public RecordReader<RecordKey, AvroGenericRecordWritable> createRecordReader(InputSplit split, TaskAttemptContext context)
  throws IOException {
  return new RecordReaderTextXml(split, context);
}
 
开发者ID:ggear,项目名称:cloudera-framework,代码行数:6,代码来源:RecordTextInputFormatXml.java

示例12: cleanup

import org.apache.hadoop.hive.serde2.avro.AvroGenericRecordWritable; //导入依赖的package包/类
@Override
protected void cleanup(
  org.apache.hadoop.mapreduce.Mapper<RecordKey, AvroGenericRecordWritable, RecordKey, AvroValue<Record>>.Context context)
  throws IOException, InterruptedException {
  multipleOutputs.close();
}
 
开发者ID:ggear,项目名称:cloudera-framework,代码行数:7,代码来源:Partition.java

示例13: getRecordReader

import org.apache.hadoop.hive.serde2.avro.AvroGenericRecordWritable; //导入依赖的package包/类
@Override
public RecordReader<KafkaKey, AvroGenericRecordWritable> getRecordReader(
		InputSplit split, JobConf conf, Reporter reporter) throws IOException {
	return new KafkaRecordReader(split, conf, reporter);
}
 
开发者ID:HiveKa,项目名称:HiveKa,代码行数:6,代码来源:KafkaInputFormat.java

示例14: createValue

import org.apache.hadoop.hive.serde2.avro.AvroGenericRecordWritable; //导入依赖的package包/类
@Override
public AvroGenericRecordWritable createValue() {
  return new AvroGenericRecordWritable();
}
 
开发者ID:HiveKa,项目名称:HiveKa,代码行数:5,代码来源:KafkaRecordReader.java

示例15: decode

import org.apache.hadoop.hive.serde2.avro.AvroGenericRecordWritable; //导入依赖的package包/类
public abstract AvroGenericRecordWritable decode(M message) ; 
开发者ID:HiveKa,项目名称:HiveKa,代码行数:2,代码来源:MessageDecoder.java


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