/** * Generates the next record batch * * @return number of records in the batch */ @Override public int next() { reader.resetForNextBatch(); int cnt = 0; try { while (cnt < MAX_RECORDS_PER_BATCH && reader.parseNext()) { cnt++; } reader.finishBatch(); return cnt; } catch (IOException | TextParsingException e) { throw UserException.dataReadError(e) .addContext( "Failure while reading file %s. Happened at or shortly before byte position %d.", split.getPath(), reader.getPos()) .build(logger); } }