/** * Returns true if there are more records. */ public boolean hasNext() throws IOException, RecordServiceException { Preconditions.checkNotNull(fetchResult_); while (record_.recordIdx_ == record_.numRecords_ - 1) { if (fetchResult_.done) { hasNext_ = false; return false; } nextBatch(); } 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(); }