@Override public boolean hasNext() { advance(); return batch.size > 0; }
@Override public void close() throws IOException { reader.close(); }
@Override public boolean hasNext() { return (current != null && nextRow < current.size) || reader.hasNext(); }
@Override public UnsafeRow next() { if (current == null || nextRow >= current.size) { current = reader.next(); nextRow = 0; } // Reset the holder to start the buffer over again. // BufferHolder.reset does the wrong thing... holder.cursor = Platform.BYTE_ARRAY_OFFSET; writer.reset(); for(int c=0; c < current.cols.length; ++c) { converter[c].convert(writer, c, current.cols[c], nextRow); } nextRow++; return row; }
public OrcIterator build() { Preconditions.checkNotNull(schema, "Schema is required"); try { Path path = new Path(file.location()); Reader reader = OrcFile.createReader(path, OrcFile.readerOptions(conf)); ColumnIdMap columnIds = new ColumnIdMap(); TypeDescription orcSchema = TypeConversion.toOrc(schema, columnIds); Reader.Options options = reader.options(); if (start != null) { options.range(start, length); } options.schema(orcSchema); return new OrcIterator(path, orcSchema, reader.rows(options)); } catch (IOException e) { throw new RuntimeException("Can't open " + file.location(), e); } } }
@Override public VectorizedRowBatch next() { // make sure we have the next batch advance(); // mark it as used advanced = false; return batch; } }