xiangfu0 commented on code in PR #13176:
URL: https://github.com/apache/pinot/pull/13176#discussion_r1611423783
##########
pinot-core/src/main/java/org/apache/pinot/core/common/ObjectSerDeUtils.java:
##########
@@ -1690,47 +1700,81 @@ public CpcSketchAccumulator deserialize(ByteBuffer
byteBuffer) {
public static final ObjectSerDe<ObjectLinkedOpenHashSet<String>>
ORDERED_STRING_SET_SER_DE =
new ObjectSerDe<ObjectLinkedOpenHashSet<String>>() {
- @Override
- public byte[] serialize(ObjectLinkedOpenHashSet<String> stringSet) {
- int size = stringSet.size();
- // Besides the value bytes, we store: size, length for each value
- long bufferSize = (1 + (long) size) * Integer.BYTES;
- byte[][] valueBytesArray = new byte[size][];
- int index = 0;
- for (String value : stringSet) {
- byte[] valueBytes = value.getBytes(UTF_8);
- bufferSize += valueBytes.length;
- valueBytesArray[index++] = valueBytes;
- }
- Preconditions.checkState(bufferSize <= Integer.MAX_VALUE, "Buffer size
exceeds 2GB");
- byte[] bytes = new byte[(int) bufferSize];
- ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
- byteBuffer.putInt(size);
- for (byte[] valueBytes : valueBytesArray) {
- byteBuffer.putInt(valueBytes.length);
- byteBuffer.put(valueBytes);
- }
- return bytes;
- }
+ @Override
Review Comment:
This is correct, the previous PR didn't format.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]