Copilot commented on code in PR #18539:
URL: https://github.com/apache/druid/pull/18539#discussion_r2353970023
##########
processing/src/test/java/org/apache/druid/segment/CursorFactoryProjectionTest.java:
##########
@@ -1649,23 +1644,19 @@ public void testProjectionFilteredProjectionMatch()
.setInterval(Intervals.ETERNITY)
.setDimFilter(new EqualityFilter("a", ColumnType.STRING,
"a", null))
.addDimension("a")
+ .setContext(Map.of(QueryContexts.QUERY_RESOURCE_ID,
RESOURCE_ID))
.build();
final boolean isRealtime = projectionsCursorFactory instanceof
IncrementalIndexCursorFactory;
// realtime projections don't have row count, so abfoo is chosen because
of how projection sorting happens
- final ExpectedProjectionGroupBy queryMetrics = new
ExpectedProjectionGroupBy(isRealtime ? "abfoo" :
"a_hourly_c_sum_filter_a_to_a");
+ final ExpectedProjectionGroupBy queryMetrics =
+ new ExpectedProjectionGroupBy(isRealtime ? "abfoo" :
"a_hourly_c_sum_filter_a_to_a");
final CursorBuildSpec buildSpec =
GroupingEngine.makeCursorBuildSpec(query, queryMetrics);
assertCursorProjection(buildSpec, queryMetrics, isRealtime ? 4 : 2);
-
- testGroupBy(
- query,
- queryMetrics,
- makeArrayResultSet(
- new Object[]{"a"}
- )
- );
+ // List.of auto unpack Object[] to Object, so use ImmutableList.of
+ testGroupBy(query, queryMetrics, ImmutableList.of(new Object[]{"a"}));
Review Comment:
The comment contains a grammatical error. It should be 'List.of auto unpacks
Object[] to Object' or 'List.of automatically unpacks Object[] to Object'.
##########
processing/src/test/java/org/apache/druid/segment/CursorFactoryProjectionTest.java:
##########
@@ -1707,19 +1694,19 @@ public void testProjectionFilteredToEmpty()
.setDimFilter(new EqualityFilter("a", ColumnType.STRING,
"nomatch", null))
.setContext(Map.of("useProjection",
"a_hourly_c_sum_filter_a_to_empty"))
.addDimension("a")
+ .setContext(Map.of(QueryContexts.QUERY_RESOURCE_ID,
RESOURCE_ID))
Review Comment:
The second setContext call overwrites the first one. These should be merged
into a single call with both keys.
```suggestion
.setContext(Map.of(
"useProjection", "a_hourly_c_sum_filter_a_to_empty",
QueryContexts.QUERY_RESOURCE_ID, RESOURCE_ID))
.addDimension("a")
```
##########
processing/src/test/java/org/apache/druid/segment/CursorFactoryProjectionTest.java:
##########
@@ -1678,22 +1669,18 @@ public void
testProjectionFilteredNoFilteredProjectionMatch()
.setInterval(Intervals.ETERNITY)
.setDimFilter(new EqualityFilter("a", ColumnType.STRING,
"b", null))
.addDimension("a")
+ .setContext(Map.of(QueryContexts.QUERY_RESOURCE_ID,
RESOURCE_ID))
.build();
final boolean isRealtime = projectionsCursorFactory instanceof
IncrementalIndexCursorFactory;
- final ExpectedProjectionGroupBy queryMetrics = new
ExpectedProjectionGroupBy(isRealtime ? "abfoo" :
"a_hourly_c_sum_with_count_latest");
+ final ExpectedProjectionGroupBy queryMetrics =
+ new ExpectedProjectionGroupBy(isRealtime ? "abfoo" :
"a_hourly_c_sum_with_count_latest");
final CursorBuildSpec buildSpec =
GroupingEngine.makeCursorBuildSpec(query, queryMetrics);
assertCursorProjection(buildSpec, queryMetrics, isRealtime ? 2 : 1);
-
- testGroupBy(
- query,
- queryMetrics,
- makeArrayResultSet(
- new Object[]{"b"}
- )
- );
+ // List.of auto unpack Object[] to Object, so use ImmutableList.of
Review Comment:
The comment contains a grammatical error. It should be 'List.of auto unpacks
Object[] to Object' or 'List.of automatically unpacks Object[] to Object'.
```suggestion
// List.of automatically unpacks Object[] to Object, so use
ImmutableList.of
```
##########
processing/src/test/java/org/apache/druid/segment/CursorFactoryProjectionTest.java:
##########
@@ -1707,19 +1694,19 @@ public void testProjectionFilteredToEmpty()
.setDimFilter(new EqualityFilter("a", ColumnType.STRING,
"nomatch", null))
.setContext(Map.of("useProjection",
"a_hourly_c_sum_filter_a_to_empty"))
.addDimension("a")
+ .setContext(Map.of(QueryContexts.QUERY_RESOURCE_ID,
RESOURCE_ID))
Review Comment:
The second setContext call overwrites the first one. These should be merged
into a single call with both keys.
```suggestion
.setContext(Map.of(
"useProjection", "a_hourly_c_sum_filter_a_to_empty",
QueryContexts.QUERY_RESOURCE_ID, RESOURCE_ID
))
.addDimension("a")
```
--
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]