FrankChen021 commented on code in PR #20793: URL: https://github.com/apache/druid/pull/20793#discussion_r4429468605
########## benchmarks/src/test/java/org/apache/druid/benchmark/query/MSQTaskScanBenchmark.java: ########## @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.druid.benchmark.query; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.druid.msq.indexing.report.MSQTaskReport; +import org.apache.druid.msq.indexing.report.MSQTaskReportPayload; +import org.apache.druid.msq.sql.MSQTaskSqlEngine; +import org.apache.druid.msq.test.MSQTestOverlordServiceClient; +import org.apache.druid.msq.test.StandardMSQComponentSupplier; +import org.apache.druid.server.SpecificSegmentsQuerySegmentWalker; +import org.apache.druid.sql.calcite.QueryTestBuilder; +import org.apache.druid.sql.calcite.SqlTestFrameworkConfig; +import org.apache.druid.sql.calcite.TempDirProducer; +import org.openjdk.jmh.infra.Blackhole; + +import java.util.List; +import java.util.Map; + +/** + * {@link MSQScanBenchmarkBase} on the MSQ task engine. + */ [email protected](MSQTaskScanBenchmark.ComponentSupplier.class) +public class MSQTaskScanBenchmark extends MSQScanBenchmarkBase +{ + @Override + protected MSQTaskReportPayload runQueryAndGetReport( + final String sql, + final Map<String, Object> context, + final Blackhole blackhole + ) + { + // Without a results-extraction step, the task engine's only result row is the task ID. + final List<Object[]> taskIdRows = new QueryTestBuilder(createCalciteTestConfig()) + .skipVectorize(true) + .queryContext(context) Review Comment: [P2] Avoid reusing the dummy task ID **Finding:** This builder inherits BaseCalciteQueryTest.QUERY_CONTEXT_DEFAULT and never overrides SQL_QUERY_ID, so MSQTaskQueryMaker derives the same query-dummy task ID for every invocation. The test overlord logs and closes the prior task on each subsequent call; with multiple JMH threads, one invocation can replace another's report before its counters are read. **Suggestion:** Assign a unique SQL query ID per invocation and close the corresponding test task after extracting its report. -- 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]
