@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); } }
@Override public AvroGenericRecordWritable getWritable(byte[] value) { GenericRecord avroRecord = null; try { avroRecord = dataReader.read(null, DecoderFactory.get().binaryDecoder(value, null)); } catch (IOException e) { Throwables.propagate(new SerDeException(e)); } avroGenericRecordWritable.setRecord(avroRecord); avroGenericRecordWritable.setRecordReaderID(uid); avroGenericRecordWritable.setFileSchema(avroRecord.getSchema()); return avroGenericRecordWritable; } }
@Override public boolean next(NullWritable nullWritable, AvroGenericRecordWritable record) throws IOException { if(isEmptyInput || !reader.hasNext() || reader.pastSync(stop)) { return false; } GenericData.Record r = (GenericData.Record)reader.next(); record.setRecord(r); record.setRecordReaderID(recordReaderID); record.setFileSchema(reader.getSchema()); return true; }
@Override public boolean next(NullWritable nullWritable, AvroGenericRecordWritable record) throws IOException { if(isEmptyInput || !reader.hasNext() || reader.pastSync(stop)) { return false; } GenericData.Record r = (GenericData.Record)reader.next(); record.setRecord(r); record.setRecordReaderID(recordReaderID); record.setFileSchema(reader.getSchema()); return true; }
@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); } }
@Override public AvroGenericRecordWritable getWritable(byte[] value) { GenericRecord avroRecord = null; try { avroRecord = dataReader.read(null, DecoderFactory.get().binaryDecoder(value, null)); } catch (IOException e) { Throwables.propagate(new SerDeException(e)); } avroGenericRecordWritable.setRecord(avroRecord); avroGenericRecordWritable.setRecordReaderID(uid); avroGenericRecordWritable.setFileSchema(avroRecord.getSchema()); return avroGenericRecordWritable; } }
@Override public boolean next(NullWritable nullWritable, AvroGenericRecordWritable record) throws IOException { if(!reader.hasNext() || reader.pastSync(stop)) { return false; } GenericData.Record r = (GenericData.Record)reader.next(); record.setRecord(r); record.setRecordReaderID(recordReaderID); record.setFileSchema(reader.getSchema()); return true; }