Skip to content

Commit 9673bf9

Browse files
committed
fix: read the codegen factory mode through its string form
Spark 3.4 has no `codegenFactoryMode` accessor and Spark 4.1 types it as the enum, so the aggregate gate did not compile on either. The conf entry's string key exists on every version, so the gate reads that and compares it to `NO_CODEGEN` ignoring case, which is how Spark accepts the value.
1 parent 62a0994 commit 9673bf9

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎spark/src/main/scala/org/apache/spark/sql/comet/operators.scala‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import org.apache.spark.sql.execution.aggregate.{BaseAggregateExec, HashAggregat
4545
import org.apache.spark.sql.execution.exchange.ReusedExchangeExec
4646
import org.apache.spark.sql.execution.joins.{BroadcastHashJoinExec, BroadcastNestedLoopJoinExec, HashJoin, ShuffledHashJoinExec, SortMergeJoinExec}
4747
import org.apache.spark.sql.execution.metric.{SQLMetric, SQLMetrics}
48+
import org.apache.spark.sql.internal.SQLConf
4849
import org.apache.spark.sql.types.{ArrayType, BinaryType, BooleanType, ByteType, DataType, DateType, DecimalType, DoubleType, FloatType, IntegerType, LongType, MapType, ShortType, StringType, StructField, StructType, TimestampNTZType, TimestampType}
4950
import org.apache.spark.sql.vectorized.ColumnarBatch
5051
import org.apache.spark.unsafe.Platform
@@ -2235,8 +2236,9 @@ object CometHashAggregateExec
22352236
// Spark turns codegen off by config, for an imperative aggregate, for a non-leaf
22362237
// CodegenFallback expression, or when the output or an input exceeds its field limit.
22372238
val codegenOff = !op.conf.wholeStageEnabled ||
2238-
CodegenObjectFactoryMode.withName(op.conf.codegenFactoryMode) ==
2239-
CodegenObjectFactoryMode.NO_CODEGEN ||
2239+
op.conf
2240+
.getConfString(SQLConf.CODEGEN_FACTORY_MODE.key)
2241+
.equalsIgnoreCase(CodegenObjectFactoryMode.NO_CODEGEN.toString) ||
22402242
op.aggregateExpressions.exists(_.aggregateFunction.isInstanceOf[ImperativeAggregate]) ||
22412243
WholeStageCodegenExec.isTooManyFields(op.conf, op.schema) ||
22422244
op.children.exists(child => WholeStageCodegenExec.isTooManyFields(op.conf, child.schema)) ||

0 commit comments

Comments
 (0)