/** * Construct a new UnsafeRow. The resulting row won't be usable until `pointTo()` has been called, * since the value returned by this constructor is equivalent to a null pointer. * * @param numFields the number of fields in this row */ public UnsafeRow(int numFields) { this.numFields = numFields; this.bitSetWidthInBytes = calculateBitSetWidthInBytes(numFields); }
public UnsafeRowWriter(BufferHolder holder, int numFields) { this.holder = holder; this.nullBitsSize = UnsafeRow.calculateBitSetWidthInBytes(numFields); this.fixedSize = nullBitsSize + 8 * numFields; this.startingOffset = holder.cursor; }
/** * Construct a new UnsafeRow. The resulting row won't be usable until `pointTo()` has been called, * since the value returned by this constructor is equivalent to a null pointer. * * @param numFields the number of fields in this row */ public UnsafeRow(int numFields) { this.numFields = numFields; this.bitSetWidthInBytes = calculateBitSetWidthInBytes(numFields); }
/** * Construct a new UnsafeRow. The resulting row won't be usable until `pointTo()` has been called, * since the value returned by this constructor is equivalent to a null pointer. * * @param numFields the number of fields in this row */ public UnsafeRow(int numFields) { this.numFields = numFields; this.bitSetWidthInBytes = calculateBitSetWidthInBytes(numFields); }
public static int calculateFixedPortionByteSize(int numFields) { return 8 * numFields + calculateBitSetWidthInBytes(numFields); }
private UnsafeRowWriter(UnsafeRow row, BufferHolder holder, int numFields) { super(holder); this.row = row; this.nullBitsSize = UnsafeRow.calculateBitSetWidthInBytes(numFields); this.fixedSize = nullBitsSize + 8 * numFields; this.startingOffset = cursor(); }
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { this.baseOffset = BYTE_ARRAY_OFFSET; this.sizeInBytes = in.readInt(); this.numFields = in.readInt(); this.bitSetWidthInBytes = calculateBitSetWidthInBytes(numFields); this.baseObject = new byte[sizeInBytes]; in.readFully((byte[]) baseObject); }
private UnsafeRowWriter(UnsafeRow row, BufferHolder holder, int numFields) { super(holder); this.row = row; this.nullBitsSize = UnsafeRow.calculateBitSetWidthInBytes(numFields); this.fixedSize = nullBitsSize + 8 * numFields; this.startingOffset = cursor(); }
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { this.baseOffset = BYTE_ARRAY_OFFSET; this.sizeInBytes = in.readInt(); this.numFields = in.readInt(); this.bitSetWidthInBytes = calculateBitSetWidthInBytes(numFields); this.baseObject = new byte[sizeInBytes]; in.readFully((byte[]) baseObject); }
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { this.baseOffset = BYTE_ARRAY_OFFSET; this.sizeInBytes = in.readInt(); this.numFields = in.readInt(); this.bitSetWidthInBytes = calculateBitSetWidthInBytes(numFields); this.baseObject = new byte[sizeInBytes]; in.readFully((byte[]) baseObject); }
protected FixedLengthRowBasedKeyValueBatch(StructType keySchema, StructType valueSchema, int maxRows, TaskMemoryManager manager) { super(keySchema, valueSchema, maxRows, manager); int keySize = keySchema.size() * 8; // each fixed-length field is stored in a 8-byte word int valueSize = valueSchema.size() * 8; klen = keySize + UnsafeRow.calculateBitSetWidthInBytes(keySchema.length()); vlen = valueSize + UnsafeRow.calculateBitSetWidthInBytes(valueSchema.length()); recordLength = klen + vlen + 8; } }
protected FixedLengthRowBasedKeyValueBatch(StructType keySchema, StructType valueSchema, int maxRows, TaskMemoryManager manager) { super(keySchema, valueSchema, maxRows, manager); int keySize = keySchema.size() * 8; // each fixed-length field is stored in a 8-byte word int valueSize = valueSchema.size() * 8; klen = keySize + UnsafeRow.calculateBitSetWidthInBytes(keySchema.length()); vlen = valueSize + UnsafeRow.calculateBitSetWidthInBytes(valueSchema.length()); recordLength = klen + vlen + 8; } }
protected FixedLengthRowBasedKeyValueBatch(StructType keySchema, StructType valueSchema, int maxRows, TaskMemoryManager manager) { super(keySchema, valueSchema, maxRows, manager); int keySize = keySchema.size() * 8; // each fixed-length field is stored in a 8-byte word int valueSize = valueSchema.size() * 8; klen = keySize + UnsafeRow.calculateBitSetWidthInBytes(keySchema.length()); vlen = valueSize + UnsafeRow.calculateBitSetWidthInBytes(valueSchema.length()); recordLength = klen + vlen + 8; } }
@Override public void read(Kryo kryo, Input in) { this.baseOffset = BYTE_ARRAY_OFFSET; this.sizeInBytes = in.readInt(); this.numFields = in.readInt(); this.bitSetWidthInBytes = calculateBitSetWidthInBytes(numFields); this.baseObject = new byte[sizeInBytes]; in.read((byte[]) baseObject); } }
@Override public void read(Kryo kryo, Input in) { this.baseOffset = BYTE_ARRAY_OFFSET; this.sizeInBytes = in.readInt(); this.numFields = in.readInt(); this.bitSetWidthInBytes = calculateBitSetWidthInBytes(numFields); this.baseObject = new byte[sizeInBytes]; in.read((byte[]) baseObject); } }
@Override public void read(Kryo kryo, Input in) { this.baseOffset = BYTE_ARRAY_OFFSET; this.sizeInBytes = in.readInt(); this.numFields = in.readInt(); this.bitSetWidthInBytes = calculateBitSetWidthInBytes(numFields); this.baseObject = new byte[sizeInBytes]; in.read((byte[]) baseObject); } }
public BufferHolder(UnsafeRow row, int initialSize) { int bitsetWidthInBytes = UnsafeRow.calculateBitSetWidthInBytes(row.numFields()); if (row.numFields() > (Integer.MAX_VALUE - initialSize - bitsetWidthInBytes) / 8) { throw new UnsupportedOperationException( "Cannot create BufferHolder for input UnsafeRow because there are " + "too many fields (number of fields: " + row.numFields() + ")"); } this.fixedSize = bitsetWidthInBytes + 8 * row.numFields(); this.buffer = new byte[fixedSize + initialSize]; this.row = row; this.row.pointTo(buffer, buffer.length); }
BufferHolder(UnsafeRow row, int initialSize) { int bitsetWidthInBytes = UnsafeRow.calculateBitSetWidthInBytes(row.numFields()); if (row.numFields() > (ARRAY_MAX - initialSize - bitsetWidthInBytes) / 8) { throw new UnsupportedOperationException( "Cannot create BufferHolder for input UnsafeRow because there are " + "too many fields (number of fields: " + row.numFields() + ")"); } this.fixedSize = bitsetWidthInBytes + 8 * row.numFields(); int roundedSize = ByteArrayMethods.roundNumberOfBytesToNearestWord(fixedSize + initialSize); this.buffer = new byte[roundedSize]; this.row = row; this.row.pointTo(buffer, buffer.length); }
BufferHolder(UnsafeRow row, int initialSize) { int bitsetWidthInBytes = UnsafeRow.calculateBitSetWidthInBytes(row.numFields()); if (row.numFields() > (ARRAY_MAX - initialSize - bitsetWidthInBytes) / 8) { throw new UnsupportedOperationException( "Cannot create BufferHolder for input UnsafeRow because there are " + "too many fields (number of fields: " + row.numFields() + ")"); } this.fixedSize = bitsetWidthInBytes + 8 * row.numFields(); int roundedSize = ByteArrayMethods.roundNumberOfBytesToNearestWord(fixedSize + initialSize); this.buffer = new byte[roundedSize]; this.row = row; this.row.pointTo(buffer, buffer.length); }