/** * Returns true if there are more records, false otherwise. */ public boolean hasNext() throws IOException, RecordServiceException { return records_.hasNext(); }
/** * Returns true if there are more records, false otherwise. */ @Override public boolean hasNext() throws IOException, RecordServiceException { return records_.hasNext(); }
/** * Returns true if there are more records, false otherwise. */ @Override public boolean hasNext() throws IOException, RecordServiceException { return records_.hasNext(); }
/** * Advances to the next record. Return false if there are no more records. */ public boolean nextRecord() throws IOException { try { if (!reader_.records().hasNext()) return false; } catch (RecordServiceException e) { // TODO: is this the most proper way to deal with this in MR? throw new IOException("Could not fetch record.", e); } currentRSRecord_ = reader_.records().next(); return true; }
/** * Advances to the next record, populating key,value with the results. * This is the hot path. */ @Override public boolean next(WritableComparable<?> key, RecordServiceRecord value) throws IOException { try { if (!reader_.records().hasNext()) return false; } catch (RecordServiceException e) { // TODO: is this the most proper way to deal with this in MR? throw new IOException("Could not fetch record.", e); } value.reset(reader_.records().next()); return true; }
@Override public boolean next(LongWritable key, Text value) throws IOException { try { if (!reader_.records().hasNext()) return false; Records.Record record = reader_.records().next(); if (record.isNull(0)) { value.set(EMPTY); } else { ByteArray data = record.nextByteArray(0); value.set(data.byteBuffer().array(), data.offset(), data.len()); } key.set(recordNum_++); return true; } catch (RecordServiceException e) { throw new IOException("Could not get next record.", e); } }
/** * Advances to the next record. * Returns true if there are more values to retrieve, false otherwise. */ @Override public boolean nextKeyValue() throws IOException, InterruptedException { try { if (!reader_.records().hasNext()) return false; } catch (RecordServiceException e) { // TODO: is this the most proper way to deal with this in MR? throw new IOException("Could not fetch record.", e); } Records.Record record = reader_.records().next(); if (record.isNull(0)) { record_.set(EMPTY); } else { ByteArray data = record.nextByteArray(0); record_.set(data.byteBuffer().array(), data.offset(), data.len()); } currentKey_.set(recordNum_++); return true; }
protected Records(RecordServiceWorkerClient worker, RecordServiceWorkerClient.TaskState handle) throws IOException, RecordServiceException { worker_ = worker; handle_ = handle; closeWorker_ = false; record_ = new Record(handle.getSchema()); nextBatch(); if (record_.schema_.isCountStar) { // This is a count(*). We will read the one and only value that is the number of // records. The iterator interface will return count(*) number of NULLs. Preconditions.checkState(record_.schema_.cols.size() == 1); Preconditions.checkState(record_.schema_.cols.get(0).type.typeId == Type.BIGINT); Preconditions.checkState(record_.numRecords_ == 1); record_.numRecords_ = record_.nextLong(0); } hasNext_ = hasNext(); }