private int getRowLength() { org.apache.kudu.util.Slice rawData = getCurrentRowRawData(); if (rawData != null) { return rawData.length(); } else { return columnTypes.size(); } }
/** * Decodes this buffer's sub-region into a string with the specified * character set. */ public String toString(int index, int length, Charset charset) { if (length == 0) { return ""; } return Slices.decodeString(toByteBuffer(index, length), charset); }
/** * Generate bloom filter, default hashing is {@code Murmur2} and false positive rate is 0.01. * @param nBytes size of bloom filter in bytes */ public static BloomFilter bySize(int nBytes) { return bySizeAndFPRate(nBytes, DEFAULT_FP_RATE); }
/** {@inheritDoc} */ @Override public ByteVec clone() { ByteVec clone = ByteVec.withCapacity(data.length); clone.append(this); return clone; } }
/** * Generate bloom filter, default hashing is {@code Murmur2}. * @param expectedCount The expected number of elements, targeted by this bloom filter. * It is used to size the bloom filter. * @param fpRate the probability that TServer will erroneously return a record that has not * ever been {@code put} into the {@code BloomFilter}. */ public static BloomFilter byCountAndFPRate(int expectedCount, double fpRate) { return byCountAndFPRate(expectedCount, fpRate, HashFunctions.MURMUR2); }
/** * Appends an element to the vector. * @param element the element to append */ public void push(byte element) { reserveAdditional(1); data[len++] = element; }
@Override public Subject run() { return SecurityUtil.getSubjectFromTicketCacheOrNull(); } });
/** * Update bloom filter with a {@code byte}. */ public void put(byte data) { byteBuffer[0] = data; updateBitset(byteBuffer, 1); }
/** * Creates a new vector. * @return the new vector. */ public static ByteVec create() { return new ByteVec(DEFAULT_CAPACITY); }
public static Slice allocate(int capacity) { if (capacity == 0) { return EMPTY_SLICE; } return new Slice(capacity); }
/** * Appends all of the bytes from another byte array to this vec. * @param values the values to append */ public void append(byte[] values) { append(values, 0, values.length); }
/** * Gets an unsigned byte at the specified absolute {@code index} in this * buffer. * * @throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or * {@code index + 1} is greater than {@code this.capacity} */ public short getUnsignedByte(int index) { return (short) (getByte(index) & 0xFF); }
/** * Decodes this buffer's readable bytes into a string with the specified * character set name. */ public String toString(Charset charset) { return toString(0, length, charset); }
private Insert createInsert(int key) { return createBasicSchemaInsert(table, key); } }
/** * Generate bloom filter, default hashing is {@code Murmur2}. * @param nBytes size of bloom filter in bytes * @param fpRate the probability that TServer will erroneously return a record that has not * ever been {@code put} into the {@code BloomFilter}. */ public static BloomFilter bySizeAndFPRate(int nBytes, double fpRate) { return bySizeAndFPRate(nBytes, fpRate, HashFunctions.MURMUR2); }
/** * Generate bloom filter, default hashing is {@code Murmur2} and false positive rate is 0.01. * @param expectedCount The expected number of elements, targeted by this bloom filter. * It is used to size the bloom filter. */ public static BloomFilter byCount(int expectedCount) { return byCountAndFPRate(expectedCount, DEFAULT_FP_RATE); }
/** * Update bloom filter with a {@code byte[]}. */ public void put(byte[] data) { updateBitset(data, data.length); }
/** * Wrap an existing array with a vector. * The array should not be modified after this call. * @param data the initial data for the vector * @return a vector wrapping the data */ public static ByteVec wrap(byte[] data) { return new ByteVec(data); }
public static Slice wrappedBuffer(byte[] array) { if (array.length == 0) { return EMPTY_SLICE; } return new Slice(array); }
/** * Update bloom filter with a {@code short}. */ public void put(short data) { byteBuffer[0] = (byte) (data >>> 0); byteBuffer[1] = (byte) (data >>> 8); updateBitset(byteBuffer, 2); }