github-code-scanning[bot] commented on code in PR #14560:
URL: https://github.com/apache/druid/pull/14560#discussion_r1257763141
##########
processing/src/test/java/org/apache/druid/query/metadata/SegmentMetadataQueryTest.java:
##########
@@ -793,7 +806,74 @@
.intervals("2013/2014")
.toInclude(new
ListColumnIncluderator(Collections.singletonList("placement")))
.analysisTypes(SegmentMetadataQuery.AnalysisType.AGGREGATORS)
+ .merge(true) // if the aggregator strategy is unsepcified, it defaults
to strict.
+ .build();
+ TestHelper.assertExpectedObjects(
+ ImmutableList.of(mergedSegmentAnalysis),
+ myRunner.run(QueryPlus.wrap(query)),
+ "failed SegmentMetadata merging query"
+ );
+ exec.shutdownNow();
+ }
+
+ @Test
+ public void testSegmentMetadataQueryWithAggregatorsMergeLenientStrategy()
+ {
+ final Map<String, AggregatorFactory> expectedAggregators = new HashMap<>();
+ for (AggregatorFactory agg : TestIndex.METRIC_AGGS) {
+ expectedAggregators.put(agg.getName(), agg.getCombiningFactory());
+ }
+ SegmentAnalysis mergedSegmentAnalysis = new SegmentAnalysis(
+ differentIds ? "merged" : SegmentId.dummy("testSegment").toString(),
+ null,
+ new LinkedHashMap<>(
+ ImmutableMap.of(
+ "placement",
+ new ColumnAnalysis(
+ ColumnType.STRING,
+ ValueType.STRING.toString(),
+ false,
+ false,
+ 0,
+ 0,
+ NullHandling.defaultStringValue(),
+ NullHandling.defaultStringValue(),
+ null
+ )
+ )
+ ),
+ 0,
+ expectedSegmentAnalysis1.getNumRows() +
expectedSegmentAnalysis2.getNumRows(),
+ expectedAggregators,
+ null,
+ null,
+ null
+ );
+
+ QueryToolChest toolChest = FACTORY.getToolchest();
+
+ ExecutorService exec = Executors.newCachedThreadPool();
+ QueryRunner myRunner = new FinalizeResultsQueryRunner<>(
+ toolChest.mergeResults(
+ FACTORY.mergeRunners(
+ Execs.directExecutor(),
+ Lists.newArrayList(
+ toolChest.preMergeQueryDecoration(runner1),
+ toolChest.preMergeQueryDecoration(runner2)
+ )
+ )
Review Comment:
## Deprecated method or constructor invocation
Invoking [QueryRunnerFactory.mergeRunners](1) should be avoided because it
has been deprecated.
[Show more
details](https://github.com/apache/druid/security/code-scanning/843)
--
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]