Jackie-Jiang commented on code in PR #16872:
URL: https://github.com/apache/pinot/pull/16872#discussion_r2380604756
##########
pinot-query-runtime/src/test/java/org/apache/pinot/query/mailbox/GrpcSendingMailboxTest.java:
##########
@@ -46,55 +46,53 @@ public class GrpcSendingMailboxTest {
@Test(dataProvider = "byteBuffersDataProvider")
public void testByteBuffersToByteStrings(int[] byteBufferSizes, int
maxByteStringSize) {
- List<ByteBuffer> input = Arrays.stream(byteBufferSizes)
- .mapToObj(this::randomByteBuffer).collect(Collectors.toList());
+ List<ByteBuffer> input =
+
Arrays.stream(byteBufferSizes).mapToObj(this::randomByteBuffer).collect(Collectors.toList());
ByteBuffer expected = concatenateBuffers(input);
List<ByteString> output = GrpcSendingMailbox.toByteStrings(input,
maxByteStringSize);
- for (ByteString chunk: output.subList(0, output.size() - 1)) {
+ for (ByteString chunk : output.subList(0, output.size() - 1)) {
assertEquals(chunk.size(), maxByteStringSize);
}
assertTrue(output.get(output.size() - 1).size() <= maxByteStringSize);
- ByteBuffer actual = concatenateBuffers(
-
output.stream().map(ByteString::asReadOnlyByteBuffer).collect(Collectors.toList()));
+ ByteBuffer actual =
+
concatenateBuffers(output.stream().map(ByteString::asReadOnlyByteBuffer).collect(Collectors.toList()));
assertEquals(actual, expected);
}
@Test(dataProvider = "testDataBlockToByteStringsProvider")
- public void testDataBlockToByteStrings(String name, int maxByteStringSize)
throws IOException {
+ public void testDataBlockToByteStrings(String name, int maxByteStringSize)
+ throws IOException {
DataBlock dataBlock = buildTestDataBlock();
List<ByteString> output = GrpcSendingMailbox.toByteStrings(dataBlock,
maxByteStringSize);
- for (ByteString chunk: output) {
+ for (ByteString chunk : output) {
assertTrue(chunk.size() <= maxByteStringSize);
}
- DataBlock actual = DataBlockUtils.deserialize(
-
output.stream().map(ByteString::asReadOnlyByteBuffer).collect(Collectors.toList()));
+ DataBlock deserialized = DataBlockUtils.deserialize(
+ output.stream().map(byteString ->
byteString.asReadOnlyByteBuffer().slice()).collect(Collectors.toList()));
Review Comment:
Yes because the test is not really serializing the chunk, thus the position
is not 0. This `slice()` mimics the transfer
--
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]