protected Row(ColumnVector[] columns) { this.parent = null; this.fixedLenRowSize = UnsafeRow.calculateFixedPortionByteSize(columns.length); this.columns = columns; }
@Override public int compare( Object baseObj1, long baseOff1, int baseLen1, Object baseObj2, long baseOff2, int baseLen2) { // Note that since ordering doesn't need the total length of the record, we just pass 0 // into the row. row1.pointTo(baseObj1, baseOff1 + 4, 0); row2.pointTo(baseObj2, baseOff2 + 4, 0); return ordering.compare(row1, row2); } }
/** * Inserts a key-value record into the sorter. If the sorter no longer has enough memory to hold * the record, the sorter sorts the existing records in-memory, writes them out as partially * sorted runs, and then reallocates memory to hold the new record. */ public void insertKV(UnsafeRow key, UnsafeRow value) throws IOException { final UnsafeExternalRowSorter.PrefixComputer.Prefix prefix = prefixComputer.computePrefix(key); sorter.insertKVRecord( key.getBaseObject(), key.getBaseOffset(), key.getSizeInBytes(), value.getBaseObject(), value.getBaseOffset(), value.getSizeInBytes(), prefix.value, prefix.isNull); }
@Override public InternalRow get() { return new GenericInternalRow(new Object[] {i[current], j[current]}); }
/** * Return the aggregation buffer for the current group. For efficiency, all calls to this method * return the same object. If additional memory could not be allocated, then this method will * signal an error by returning null. */ public UnsafeRow getAggregationBuffer(InternalRow groupingKey) { final UnsafeRow unsafeGroupingKeyRow = this.groupingKeyProjection.apply(groupingKey); return getAggregationBufferFromUnsafeRow(unsafeGroupingKeyRow); }
public UnsafeRow getAggregationBufferFromUnsafeRow(UnsafeRow key) { return getAggregationBufferFromUnsafeRow(key, key.hashCode()); }
/** * @return true if UnsafeFixedWidthAggregationMap supports aggregation buffers with the given * schema, false otherwise. */ public static boolean supportsAggregationBufferSchema(StructType schema) { for (StructField field: schema.fields()) { if (!UnsafeRow.isMutable(field.dataType())) { return false; } } return true; }
@Override public int compare( Object baseObj1, long baseOff1, int baseLen1, Object baseObj2, long baseOff2, int baseLen2) { // Note that since ordering doesn't need the total length of the record, we just pass -1 // into the row. row1.pointTo(baseObj1, baseOff1 + 4, -1); row2.pointTo(baseObj2, baseOff2 + 4, -1); return ordering.compare(row1, row2); } }
@Override public InternalRow get() { return new GenericInternalRow(new Object[] {start, -start}); }
/** * Return the aggregation buffer for the current group. For efficiency, all calls to this method * return the same object. If additional memory could not be allocated, then this method will * signal an error by returning null. */ public UnsafeRow getAggregationBuffer(InternalRow groupingKey) { final UnsafeRow unsafeGroupingKeyRow = this.groupingKeyProjection.apply(groupingKey); return getAggregationBufferFromUnsafeRow(unsafeGroupingKeyRow); }
public UnsafeRow getAggregationBufferFromUnsafeRow(UnsafeRow key) { return getAggregationBufferFromUnsafeRow(key, key.hashCode()); }
private Row(ColumnarBatch parent) { this.parent = parent; this.fixedLenRowSize = UnsafeRow.calculateFixedPortionByteSize(parent.numCols()); this.columns = parent.columns; }
@Override public int compare( Object baseObj1, long baseOff1, int baseLen1, Object baseObj2, long baseOff2, int baseLen2) { // Note that since ordering doesn't need the total length of the record, we just pass 0 // into the row. row1.pointTo(baseObj1, baseOff1 + 4, 0); row2.pointTo(baseObj2, baseOff2 + 4, 0); return ordering.compare(row1, row2); } }
@Override public InternalRow get() { return new GenericInternalRow(new Object[] {start, -start}); }
/** * Return the aggregation buffer for the current group. For efficiency, all calls to this method * return the same object. If additional memory could not be allocated, then this method will * signal an error by returning null. */ public UnsafeRow getAggregationBuffer(InternalRow groupingKey) { final UnsafeRow unsafeGroupingKeyRow = this.groupingKeyProjection.apply(groupingKey); return getAggregationBufferFromUnsafeRow(unsafeGroupingKeyRow); }
public UnsafeRow getAggregationBufferFromUnsafeRow(UnsafeRow key) { return getAggregationBufferFromUnsafeRow(key, key.hashCode()); }
@Override public InternalRow get() { return new GenericInternalRow(new Object[] {i[current], j[current]}); }