saurabhd336 commented on code in PR #11674: URL: https://github.com/apache/pinot/pull/11674#discussion_r1340319747
########## pinot-segment-local/src/main/java/org/apache/pinot/segment/local/io/writer/impl/VarByteChunkForwardIndexWriterV4.java: ########## @@ -142,6 +144,51 @@ public void putBytes(byte[] bytes) { _nextDocId++; } + @Override + public void putStringMV(String[] values) { + // num values + length of each value + int headerSize = Integer.BYTES + Integer.BYTES * values.length; + int size = headerSize; + for (String value : values) { + size += value.getBytes(UTF_8).length; Review Comment: Ack ########## pinot-segment-local/src/main/java/org/apache/pinot/segment/local/io/writer/impl/VarByteChunkForwardIndexWriterV4.java: ########## @@ -142,6 +144,51 @@ public void putBytes(byte[] bytes) { _nextDocId++; } + @Override + public void putStringMV(String[] values) { + // num values + length of each value + int headerSize = Integer.BYTES + Integer.BYTES * values.length; + int size = headerSize; + for (String value : values) { + size += value.getBytes(UTF_8).length; + } + + // Format : [numValues][length1][length2]...[lengthN][value1][value2]...[valueN] + byte[] serializedBytes = new byte[size]; + ByteBuffer byteBuffer = ByteBuffer.wrap(serializedBytes); + byteBuffer.putInt(values.length); + byteBuffer.position(headerSize); + for (int i = 0; i < values.length; i++) { + byte[] utf8 = values[i].getBytes(UTF_8); + byteBuffer.putInt((i + 1) * Integer.BYTES, utf8.length); + byteBuffer.put(utf8); + } + + putBytes(byteBuffer.array()); Review Comment: Ack -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org