FrankChen021 commented on code in PR #19379: URL: https://github.com/apache/druid/pull/19379#discussion_r4082728445
########## benchmarks/src/test/java/org/apache/druid/benchmark/TransformSpecBenchmark.java: ########## @@ -0,0 +1,229 @@ +/* + * 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; + +import com.google.common.collect.ImmutableList; +import org.apache.druid.data.input.InputRow; +import org.apache.druid.data.input.MapBasedInputRow; +import org.apache.druid.java.util.common.DateTimes; +import org.apache.druid.math.expr.ExprMacroTable; +import org.apache.druid.query.Druids; +import org.apache.druid.query.TableDataSource; +import org.apache.druid.query.UnnestDataSource; +import org.apache.druid.query.expression.TestExprMacroTable; +import org.apache.druid.query.scan.ScanQuery; +import org.apache.druid.segment.column.ColumnType; +import org.apache.druid.segment.transform.BaseTransformer; +import org.apache.druid.segment.transform.ExpressionTransform; +import org.apache.druid.segment.transform.ScanTransformSpec; +import org.apache.druid.segment.transform.TransformSpec; +import org.apache.druid.segment.virtual.ExpressionVirtualColumn; +import org.apache.druid.testing.InitializedNullHandlingTest; +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OperationsPerInvocation; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; +import org.openjdk.jmh.infra.Blackhole; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.RunnerException; +import org.openjdk.jmh.runner.options.Options; +import org.openjdk.jmh.runner.options.OptionsBuilder; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * Measures per-row throughput of the ingestion-time transform pipeline for the three shapes + * streaming ingestion actually hits: + * NONE — TransformSpec.NONE, baseline overhead of the transform wrapper. + * EXPRESSION — TransformSpec with a single expression transform (upper(user)). + * SCAN_PASSTHROUGH — ScanTransformSpec with no unnest (scan-query baseline over a 1-row cursor). + * SCAN_VC — ScanTransformSpec with one scan-query virtual column (upper(user)), equivalent + * work to EXPRESSION but via the scan pipeline. + * SCAN_UNNEST — ScanTransformSpec that unnests an array of {@code unnestArraySize} elements. + * + * Output is nanoseconds per input row. For SCAN_UNNEST, use {@link #totalOutputRowsPerInput()} to + * translate to ns/output-row. + * + * The input row is a {@link MapBasedInputRow} matching what Kafka JSON ingestion produces. + */ +@State(Scope.Benchmark) +@BenchmarkMode(Mode.AverageTime) Review Comment: [P1] Resolve the shadowed JMH Mode type **Finding:** The class imports JMH's org.openjdk.jmh.annotations.Mode but also declares a nested enum named Mode. In @BenchmarkMode(Mode.AverageTime), the nested enum wins name resolution and has no AverageTime constant, so this new benchmark source does not compile and blocks the benchmarks module/build. **Suggestion:** Rename the benchmark parameter enum (for example, to BenchmarkMode) or fully qualify org.openjdk.jmh.annotations.Mode in the annotation so the JMH mode type is selected. -- 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]
