comphead commented on code in PR #6805: URL: https://github.com/apache/datafusion-comet/pull/6805#discussion_r4238682902
########## spark/src/test/scala/org/apache/spark/sql/benchmark/CometShuffleReadKillBenchmark.scala: ########## @@ -0,0 +1,380 @@ +/* + * 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.spark.sql.benchmark + +import java.io.File +import java.nio.charset.StandardCharsets +import java.util.concurrent.atomic.AtomicLong +import java.util.concurrent.locks.LockSupport + +import scala.collection.mutable + +import org.apache.spark.{SparkConf, TaskContext} +import org.apache.spark.rdd.RDD +import org.apache.spark.scheduler.{SparkListener, SparkListenerTaskEnd} +import org.apache.spark.sql.SparkSession +import org.apache.spark.sql.comet.{CometColumnarToRowExec, CometExec, CometNativeColumnarToRowExec, CometNativeExec} +import org.apache.spark.sql.execution.{InputAdapter, SparkPlan} +import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanExec +import org.apache.spark.sql.functions.col +import org.apache.spark.sql.internal.SQLConf + +import org.apache.comet.{CometConf, CometSparkSessionExtensions} + +/** + * Measures how long a Comet reduce task keeps running after it is killed while it reads its + * shuffle (review of apache/datafusion-comet#6805). + * + * One map task writes the whole shuffle as one block, and one reduce task reads it with a native + * project on top. On the `aqe` path the project reads the shuffle directly in native code + * (`ShuffleScan` over `CometShuffleBlockIterator`), which Comet does only behind an AQE query + * stage. On the `noaqe` path it reads it through `NativeBatchDecoderIterator`. + * + * Each trial runs the reduce task alone over the same shuffle. A kill trial cancels the job + * `KillAfterMs` after the task starts, with or without interrupting the task's thread, as + * `spark.job.interruptOnCancel` selects, and measures how long the task runs after the cancel, + * until its completion listeners run. A trial without a kill measures the whole task. + * + * With `variants=fix,head`, the default, the variants run in turn in one JVM. `head` sets the + * local property `spark.comet.benchmark.skipKillCheck`, which only a temporary benchmark build + * reads: it makes `readAsRawStream` skip its kill check, as #6805 did before the fix. Any other + * variant name only labels the classes on the classpath. `paths=aqe,noaqe` selects the read + * paths, `rows=N` the rows of the shuffle and `trials=N` the trials. + */ +object CometShuffleReadKillBenchmark extends CometBenchmarkBase { Review Comment: Agreed, removed both in `1346697f8c`, which also clears the lint failures. They were local tools for this review and came in by accident with the fix. I'll keep `CometHashJoinTaskTimeBenchmark` for #6528 and open it as its own PR there, without the kill-check mode. -- 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]
