Copilot commented on code in PR #17101:
URL: https://github.com/apache/pinot/pull/17101#discussion_r2471512860


##########
pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/operator/exchange/BlockExchangeTest.java:
##########
@@ -86,9 +86,11 @@ public void shouldSendEosBlockToAllDestinations()
   public void shouldSendDataBlocksOnlyToTargetDestination()
       throws Exception {
     // Given:
-    List<SendingMailbox> destinations = ImmutableList.of(_mailbox1);
+    List<SendingMailbox> destinations = List.of(_mailbox1);
     BlockExchange exchange = new TestBlockExchange(destinations);
-    RowHeapDataBlock block = new RowHeapDataBlock(ImmutableList.of(new 
Object[]{"val"}),
+    RowHeapDataBlock block = new RowHeapDataBlock(new ArrayList<>() {{
+      add(new Object[]{"val"});
+    }},

Review Comment:
   Replace the anonymous ArrayList with double brace initialization with 
List.of() for better readability and performance. The double brace 
initialization creates an anonymous subclass and holds an implicit reference to 
the outer instance.
   ```suggestion
       RowHeapDataBlock block = new RowHeapDataBlock(
           List.of(new Object[]{"val"}),
   ```



##########
pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/operator/exchange/BlockExchangeTest.java:
##########
@@ -139,18 +143,22 @@ public void shouldSignalEarlyTerminationProperly()
   public void shouldSplitBlocks()
       throws Exception {
     // Given:
-    List<SendingMailbox> destinations = ImmutableList.of(_mailbox1);
+    List<SendingMailbox> destinations = List.of(_mailbox1);
 
     DataSchema schema = new DataSchema(new String[]{"foo"}, new 
ColumnDataType[]{ColumnDataType.STRING});
 
     RowHeapDataBlock inBlock =
-        new RowHeapDataBlock(ImmutableList.of(new Object[]{"one"}, new 
Object[]{"two"}), schema);
+        new RowHeapDataBlock(List.of(new Object[]{"one"}, new 
Object[]{"two"}), schema);
 
-    RowHeapDataBlock outBlockOne = new RowHeapDataBlock(ImmutableList.of(new 
Object[]{"one"}), schema);
+    RowHeapDataBlock outBlockOne = new RowHeapDataBlock(new ArrayList<>() {{
+      add(new Object[]{"one"});
+    }}, schema);

Review Comment:
   Replace the anonymous ArrayList with double brace initialization with 
List.of() for better readability and performance. The double brace 
initialization creates an anonymous subclass and holds an implicit reference to 
the outer instance.



##########
pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/operator/exchange/BlockExchangeTest.java:
##########
@@ -139,18 +143,22 @@ public void shouldSignalEarlyTerminationProperly()
   public void shouldSplitBlocks()
       throws Exception {
     // Given:
-    List<SendingMailbox> destinations = ImmutableList.of(_mailbox1);
+    List<SendingMailbox> destinations = List.of(_mailbox1);
 
     DataSchema schema = new DataSchema(new String[]{"foo"}, new 
ColumnDataType[]{ColumnDataType.STRING});
 
     RowHeapDataBlock inBlock =
-        new RowHeapDataBlock(ImmutableList.of(new Object[]{"one"}, new 
Object[]{"two"}), schema);
+        new RowHeapDataBlock(List.of(new Object[]{"one"}, new 
Object[]{"two"}), schema);
 
-    RowHeapDataBlock outBlockOne = new RowHeapDataBlock(ImmutableList.of(new 
Object[]{"one"}), schema);
+    RowHeapDataBlock outBlockOne = new RowHeapDataBlock(new ArrayList<>() {{
+      add(new Object[]{"one"});
+    }}, schema);
 
-    RowHeapDataBlock outBlockTwo = new RowHeapDataBlock(ImmutableList.of(new 
Object[]{"two"}), schema);
+    RowHeapDataBlock outBlockTwo = new RowHeapDataBlock(new ArrayList<>() {{
+      add(new Object[]{"two"});
+    }}, schema);

Review Comment:
   Replace the anonymous ArrayList with double brace initialization with 
List.of() for better readability and performance. The double brace 
initialization creates an anonymous subclass and holds an implicit reference to 
the outer instance.



##########
pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/operator/exchange/BlockExchangeTest.java:
##########
@@ -108,9 +110,11 @@ public void shouldSendDataBlocksOnlyToTargetDestination()
   public void shouldSignalEarlyTerminationProperly()
       throws Exception {
     // Given:
-    List<SendingMailbox> destinations = ImmutableList.of(_mailbox1, _mailbox2);
+    List<SendingMailbox> destinations = List.of(_mailbox1, _mailbox2);
     BlockExchange exchange = new TestBlockExchange(destinations);
-    RowHeapDataBlock block = new RowHeapDataBlock(ImmutableList.of(new 
Object[]{"val"}),
+    RowHeapDataBlock block = new RowHeapDataBlock(new ArrayList<>() {{
+      add(new Object[]{"val"});
+    }},

Review Comment:
   Replace the anonymous ArrayList with double brace initialization with 
List.of() for better readability and performance. The double brace 
initialization creates an anonymous subclass and holds an implicit reference to 
the outer instance.



-- 
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]

Reply via email to