public boolean next(Text key, Text ignore) throws IOException { if (!reader.hasNext() || reader.pastSync(end)) return false; datum = reader.next(datum); if (datum instanceof ByteBuffer) { ByteBuffer b = (ByteBuffer) datum; if (b.hasArray()) { int offset = b.arrayOffset(); int start = b.position(); int length = b.remaining(); key.set(b.array(), offset + start, offset + start + length); } else { byte[] bytes = new byte[b.remaining()]; b.duplicate().get(bytes); key.set(bytes); } } else { key.set(GenericData.get().toString(datum)); } return true; }
public boolean next(AvroWrapper<T> wrapper, NullWritable ignore) throws IOException { if (!reader.hasNext() || reader.pastSync(end)) return false; wrapper.datum(reader.next(wrapper.datum())); 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 boolean pastSync(long position) throws IOException { return reader.pastSync(position); }
@Override public boolean nextKeyValue() throws IOException, InterruptedException { if (reader.pastSync(end)) { return false; } try { currentArray = reader.next(); } catch (NoSuchElementException e) { return false; } return true; }
@Override public boolean next(Text key, Text value) throws IOException { if (!reader.hasNext() || reader.pastSync(end)) { return false; } datum = reader.next(datum); key.set(new String(datum.toString().getBytes("UTF-8"), "UTF-8")); return true; } }
public boolean next(Text key, Text value) throws IOException { if (!reader.hasNext() || reader.pastSync(end)) { return false; } StringBuilder buf = new StringBuilder(); JSONUtils.writeJSON(reader.next(), buf); key.set(buf.toString()); return true; }
@Override public boolean hasNext() { try { return (reader.hasNext() && !reader.pastSync(end)); } catch (IOException e) { throw new RuntimeIOException(e, "Failed to check range end: %d", end); } }
@Override public boolean nextKeyValue() throws IOException, InterruptedException { Preconditions.checkState(currentRecord != null); // Stop reading as soon as we hit a sync point out of our split: if (dataFileReader.hasNext() && !dataFileReader.pastSync(splitStart + splitLength)) { currentKey.set(currentKey.get() + 1); dataFileReader.next(currentRecord); return true; } else { return false; } }
@Override public boolean nextKeyValue() throws IOException, InterruptedException { if (reader.pastSync(end)) { return false; } try { currentRecord = reader.next(new GenericData.Record(schema)); } catch (NoSuchElementException e) { return false; } catch (IOException ioe) { reader.sync(reader.tell()+1); throw ioe; } return true; }
@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); return true; }
@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); return true; }
public boolean next(TypedBytesWritable key, TypedBytesWritable value) throws IOException { if (!reader.hasNext() || reader.pastSync(end)) { return false; } key.setValue(""); // until https://github.com/apache/avro/pull/2/ is fixed, we can not rely // on toString() to provide a correct JSON string with unicode. //value.setValue(reader.next().toString()); StringBuilder buf = new StringBuilder(); JSONUtils.writeJSON(reader.next(), buf); value.setValue(buf.toString()); return true; }
@Override public boolean nextKeyValue() throws IOException, InterruptedException { if (!reader.hasNext() || reader.pastSync(end)) return false; wrapper.datum(reader.next(wrapper.datum())); return true; }
public boolean next(AvroWrapper<T> wrapper, NullWritable ignore) throws IOException { if (!reader.hasNext() || reader.pastSync(end)) return false; wrapper.datum(reader.next(wrapper.datum())); return true; }
@Override public boolean nextKeyValue() throws IOException, InterruptedException { if (!reader.hasNext() || reader.pastSync(end)){ return false; } wrapper.datum(reader.next(wrapper.datum())); return true; }
@Override public boolean nextKeyValue() throws IOException, InterruptedException { if (!reader.hasNext() || reader.pastSync(end)) return false; wrapper.datum(reader.next(wrapper.datum())); return true; }
@Override public boolean nextKeyValue() throws IOException, InterruptedException { if (!reader.hasNext() || reader.pastSync(end)){ return false; } wrapper.datum(reader.next(wrapper.datum())); return true; }
@Override public boolean nextKeyValue() throws IOException, InterruptedException { if (!reader.hasNext() || reader.pastSync(end)) { key = null; value = null; return false; } if (key == null) { key = new AvroWrapper<T>(); } if (value == null) { value = NullWritable.get(); } key.datum(reader.next(key.datum())); return true; }
@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; }