sunchao commented on code in PR #5614: URL: https://github.com/apache/datafusion-comet/pull/5614#discussion_r3921074910
########## spark/src/test/scala/org/apache/spark/sql/benchmark/CometSequenceBenchmark.scala: ########## @@ -0,0 +1,68 @@ +/* + * 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 + +/** + * Benchmark to measure performance of Comet's native `sequence` kernel against Spark's codegen + * (issue #5349). Integral shapes run natively under Comet; the date case stays on the JVM codegen + * dispatcher in both arms and is included to show that path is unchanged. To run this benchmark: + * {{{ + * SPARK_GENERATE_BENCHMARK_FILES=1 make benchmark-org.apache.spark.sql.benchmark.CometSequenceBenchmark + * }}} + * Results will be written to "spark/benchmarks/CometSequenceBenchmark-**results.txt". + */ +object CometSequenceBenchmark extends CometBenchmarkBase { + + private val sequenceQueries = List( + ("seq_short_5_elems", "SELECT sequence(c_start, c_start + 4) FROM parquetV1Table"), + ("seq_spine_365_elems", "SELECT sequence(c_start, c_start + 364) FROM parquetV1Table"), Review Comment: [P2] Make the integral benchmark exercise native sequence Could you materialize the integral endpoints as columns in the prepared Parquet table, then verify that these cases use `spark_sequence` before timing them? Every integral query here passes an arithmetic expression such as `c_start + 4` or `c_null_start + 364`. `argsAreLiteralsOrRefs` rejects those arguments, so the complete `Sequence` goes through the JVM dispatcher, or falls back to Spark if dispatch is unavailable. `runExpressionBenchmark` only checks Comet operators and does not catch expression dispatch. These queries therefore cannot measure this native kernel's Spark-versus-Comet benefit. Could you refresh the comparison with leaf arguments and retain the date case as a dispatcher control? -- 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]
