| 210 | } |
| 211 | |
| 212 | @Override |
| 213 | public Tuple getNext() throws IOException { |
| 214 | try { |
| 215 | Tuple t = null; |
| 216 | if(reader == null) { |
| 217 | // first call |
| 218 | return getNextHelper(); |
| 219 | } else { |
| 220 | // we already have a reader initialized |
| 221 | t = wrappedLoadFunc.getNext(); |
| 222 | if(t != null) { |
| 223 | return t; |
| 224 | } |
| 225 | // if loadfunc returned null, we need to read next split |
| 226 | // if there is one |
| 227 | updateCurSplitIndex(); |
| 228 | return getNextHelper(); |
| 229 | } |
| 230 | } catch (InterruptedException e) { |
| 231 | throw new IOException(e); |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | private Tuple getNextHelper() throws IOException, InterruptedException { |
| 236 | Tuple t = null; |