@Description("concatenates given strings") @ScalarFunction @SqlType(VarcharType.class) public static Slice concat( @SqlType(VarcharType.class) Slice str1, @SqlType(VarcharType.class) Slice str2) { Slice concat = Slices.allocate(str1.length() + str2.length()); concat.setBytes(0, str1); concat.setBytes(str1.length(), str2); return concat; }
public void addRecord() { // record header bufferSlice.setInt( position, nextVariableLengthDataOffset); // nextVariableLengthDataOffset means record size bufferSlice.setBytes(position + 4, nullBitSet); count++; this.position += nextVariableLengthDataOffset; this.nextVariableLengthDataOffset = fixedRecordSize; Arrays.fill(nullBitSet, (byte) -1); // flush if next record will not fit in this buffer if (buffer.capacity() < position + nextVariableLengthDataOffset + stringReferenceSize) { flush(); } }