@Override public final int readInteger() { return getBuffer(4).getInt(); }
@Override public final float readFloat() { return getBuffer(4).getFloat(); }
@Override public final long readLong() { return getBuffer(8).getLong(); }
@Override public final float readFloat() { return getBuffer(4).getFloat(); }
@Override public final int readInteger() { return getBuffer(4).getInt(); }
@Override public final double readDouble() { return getBuffer(8).getDouble(); }
@Override public final long readLong() { return getBuffer(8).getLong(); }
@Override public final double readDouble() { return getBuffer(8).getDouble(); }
@Override public final void readBytes(int total, WritableColumnVector c, int rowId) { // Bytes are stored as a 4-byte little endian int. Just read the first byte. // TODO: consider pushing this in ColumnVector by adding a readBytes with a stride. int requiredBytes = total * 4; ByteBuffer buffer = getBuffer(requiredBytes); for (int i = 0; i < total; i += 1) { c.putByte(rowId + i, buffer.get()); // skip the next 3 bytes buffer.position(buffer.position() + 3); } }
@Override public final void readBytes(int total, WritableColumnVector c, int rowId) { // Bytes are stored as a 4-byte little endian int. Just read the first byte. // TODO: consider pushing this in ColumnVector by adding a readBytes with a stride. int requiredBytes = total * 4; ByteBuffer buffer = getBuffer(requiredBytes); for (int i = 0; i < total; i += 1) { c.putByte(rowId + i, buffer.get()); // skip the next 3 bytes buffer.position(buffer.position() + 3); } }
@Override public final void readFloats(int total, WritableColumnVector c, int rowId) { int requiredBytes = total * 4; ByteBuffer buffer = getBuffer(requiredBytes); if (buffer.hasArray()) { int offset = buffer.arrayOffset() + buffer.position(); c.putFloats(rowId, total, buffer.array(), offset); } else { for (int i = 0; i < total; i += 1) { c.putFloat(rowId + i, buffer.getFloat()); } } }
@Override public final void readIntegers(int total, WritableColumnVector c, int rowId) { int requiredBytes = total * 4; ByteBuffer buffer = getBuffer(requiredBytes); if (buffer.hasArray()) { int offset = buffer.arrayOffset() + buffer.position(); c.putIntsLittleEndian(rowId, total, buffer.array(), offset); } else { for (int i = 0; i < total; i += 1) { c.putInt(rowId + i, buffer.getInt()); } } }
@Override public final Binary readBinary(int len) { ByteBuffer buffer = getBuffer(len); if (buffer.hasArray()) { return Binary.fromConstantByteArray( buffer.array(), buffer.arrayOffset() + buffer.position(), len); } else { byte[] bytes = new byte[len]; buffer.get(bytes); return Binary.fromConstantByteArray(bytes); } } }
@Override public final void readDoubles(int total, WritableColumnVector c, int rowId) { int requiredBytes = total * 8; ByteBuffer buffer = getBuffer(requiredBytes); if (buffer.hasArray()) { int offset = buffer.arrayOffset() + buffer.position(); c.putDoubles(rowId, total, buffer.array(), offset); } else { for (int i = 0; i < total; i += 1) { c.putDouble(rowId + i, buffer.getDouble()); } } }
@Override public final void readFloats(int total, WritableColumnVector c, int rowId) { int requiredBytes = total * 4; ByteBuffer buffer = getBuffer(requiredBytes); if (buffer.hasArray()) { int offset = buffer.arrayOffset() + buffer.position(); c.putFloats(rowId, total, buffer.array(), offset); } else { for (int i = 0; i < total; i += 1) { c.putFloat(rowId + i, buffer.getFloat()); } } }
@Override public final Binary readBinary(int len) { ByteBuffer buffer = getBuffer(len); if (buffer.hasArray()) { return Binary.fromConstantByteArray( buffer.array(), buffer.arrayOffset() + buffer.position(), len); } else { byte[] bytes = new byte[len]; buffer.get(bytes); return Binary.fromConstantByteArray(bytes); } } }
@Override public final void readDoubles(int total, WritableColumnVector c, int rowId) { int requiredBytes = total * 8; ByteBuffer buffer = getBuffer(requiredBytes); if (buffer.hasArray()) { int offset = buffer.arrayOffset() + buffer.position(); c.putDoubles(rowId, total, buffer.array(), offset); } else { for (int i = 0; i < total; i += 1) { c.putDouble(rowId + i, buffer.getDouble()); } } }
@Override public final void readLongs(int total, WritableColumnVector c, int rowId) { int requiredBytes = total * 8; ByteBuffer buffer = getBuffer(requiredBytes); if (buffer.hasArray()) { int offset = buffer.arrayOffset() + buffer.position(); c.putLongsLittleEndian(rowId, total, buffer.array(), offset); } else { for (int i = 0; i < total; i += 1) { c.putLong(rowId + i, buffer.getLong()); } } }
@Override public final void readLongs(int total, WritableColumnVector c, int rowId) { int requiredBytes = total * 8; ByteBuffer buffer = getBuffer(requiredBytes); if (buffer.hasArray()) { int offset = buffer.arrayOffset() + buffer.position(); c.putLongsLittleEndian(rowId, total, buffer.array(), offset); } else { for (int i = 0; i < total; i += 1) { c.putLong(rowId + i, buffer.getLong()); } } }
@Override public final void readIntegers(int total, WritableColumnVector c, int rowId) { int requiredBytes = total * 4; ByteBuffer buffer = getBuffer(requiredBytes); if (buffer.hasArray()) { int offset = buffer.arrayOffset() + buffer.position(); c.putIntsLittleEndian(rowId, total, buffer.array(), offset); } else { for (int i = 0; i < total; i += 1) { c.putInt(rowId + i, buffer.getInt()); } } }