public ColumnarBatch(ColumnVector[] columns) { this.columns = columns; this.row = new MutableColumnarRow(columns); } }
public ColumnarBatch(ColumnVector[] columns) { this.columns = columns; this.row = new MutableColumnarRow(columns); } }
/** * Returns an iterator over the rows in this batch. */ public Iterator<InternalRow> rowIterator() { final int maxRows = numRows; final MutableColumnarRow row = new MutableColumnarRow(columns); return new Iterator<InternalRow>() { int rowId = 0; @Override public boolean hasNext() { return rowId < maxRows; } @Override public InternalRow next() { if (rowId >= maxRows) { throw new NoSuchElementException(); } row.rowId = rowId++; return row; } @Override public void remove() { throw new UnsupportedOperationException(); } }; }
/** * Returns an iterator over the rows in this batch. */ public Iterator<InternalRow> rowIterator() { final int maxRows = numRows; final MutableColumnarRow row = new MutableColumnarRow(columns); return new Iterator<InternalRow>() { int rowId = 0; @Override public boolean hasNext() { return rowId < maxRows; } @Override public InternalRow next() { if (rowId >= maxRows) { throw new NoSuchElementException(); } row.rowId = rowId++; return row; } @Override public void remove() { throw new UnsupportedOperationException(); } }; }
public AggregateHashMap(StructType schema, int capacity, double loadFactor, int maxSteps) { // We currently only support single key-value pair that are both longs assert (schema.size() == 2 && schema.fields()[0].dataType() == LongType && schema.fields()[1].dataType() == LongType); // capacity should be a power of 2 assert (capacity > 0 && ((capacity & (capacity - 1)) == 0)); this.maxSteps = maxSteps; numBuckets = (int) (capacity / loadFactor); columnVectors = OnHeapColumnVector.allocateColumns(capacity, schema); aggBufferRow = new MutableColumnarRow(columnVectors); buckets = new int[numBuckets]; Arrays.fill(buckets, -1); }
public AggregateHashMap(StructType schema, int capacity, double loadFactor, int maxSteps) { // We currently only support single key-value pair that are both longs assert (schema.size() == 2 && schema.fields()[0].dataType() == LongType && schema.fields()[1].dataType() == LongType); // capacity should be a power of 2 assert (capacity > 0 && ((capacity & (capacity - 1)) == 0)); this.maxSteps = maxSteps; numBuckets = (int) (capacity / loadFactor); columnVectors = OnHeapColumnVector.allocateColumns(capacity, schema); aggBufferRow = new MutableColumnarRow(columnVectors); buckets = new int[numBuckets]; Arrays.fill(buckets, -1); }