dwsmith1983 commented on code in PR #5867:
URL: https://github.com/apache/datafusion-comet/pull/5867#discussion_r4750185941
##########
spark/src/main/scala/org/apache/comet/rules/CometExecRule.scala:
##########
@@ -1345,9 +1345,13 @@ case class CometExecRule(session: SparkSession,
queryStagePrep: Boolean = false)
// skip a function's arguments (see
`QueryPlanSerde.canShortCircuitNulls`). Spark's
// generated code for an aggregate shares them whatever
// spark.sql.subexpressionElimination.enabled says, and other operators
only when it is on.
+ // Only a project shares however Spark runs it. A filter in whole-stage
code does not
+ // through Spark 4.1, and an aggregate's expressions mix its functions'
inputs, which
+ // share, with its results.
val nativeOp = QueryPlanSerde.withSharedSubexpressions(
op.expressions,
- alwaysShared = op.isInstanceOf[BaseAggregateExec]) {
+ alwaysShared = op.isInstanceOf[BaseAggregateExec],
+ certain = op.isInstanceOf[ProjectExec]) {
Review Comment:
> Could the exemption exclude known interpreted execution and add this
fixture variant?
Done in 628bcf86b. `withSharedSubexpressions` treats no operator's sharing
as certain when `spark.sql.codegen.factoryMode` is `NO_CODEGEN`, which covers
the project, the TakeOrderedAndProject list and the shuffle keys.
`map_lookup_shared_subexpression_interpreted.sql` runs the repeated lookup with
your four settings and expects Comet to fall back, along with the shuffle and
top-k forms, and a lookup without the repeat still dispatches. A FALLBACK-mode
compile failure that drops to the interpreted projection isn't visible when the
plan is converted, so that case stays open.
The native null short-circuit has a similar gap under `NO_CODEGEN`, on main
as well, which I filed as #7814.
--
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]