Skip to content

[AURON #2772] Add Java codegen, fusion, and subexpression reuse for Spark expression fallback on Arrow - #2775

Open
Deegue wants to merge 1 commit into
apache:masterfrom
Deegue:auron_#2772_support_expression_fallback_codegen
Open

Deegue wants to merge 1 commit into
apache:masterfrom
Deegue:auron_#2772_support_expression_fallback_codegen

Conversation

@Deegue

@Deegue Deegue commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #2772

Rationale for this change

A native projection can delegate individual expressions to Spark. For example, given a string column s, SELECT CAST(s AS DATE), CAST(s AS TIMESTAMP) FROM events can evaluate two Spark wrappers over the same Arrow batch. Each wrapper visits the rows and writes its own result. The two casts can instead share the input vector, one JVM callback and one row loop.

What changes are included in this PR?

  • Serialize the driver's fallback mode and fusion eligibility with each Spark expression. The native evaluator groups adjacent eligible deterministic outputs after projection pruning, subject to Spark's codegen field limit.
  • Use Catalyst to generate Java that reads the bound Arrow vectors and writes into batch-sized output vectors. The grouped callback returns its output columns in projection order.
  • When Spark subexpression elimination is enabled, evaluate repeated deterministic work on first use in each row. This preserves short-circuiting. Recover from code-generation failures before processing rows and propagate runtime errors without replaying the batch.

Are there any user-facing changes?

The new SQL setting spark.auron.udf.fallback.evalMode defaults to interpreted. Set it to grouped_fused before planning a query to enable generated evaluation. A single eligible output can also use generated code. Inputs or outputs that the direct Arrow kernel does not support use the scalar fallback path.

How was this patch tested?

UTs.

@github-actions github-actions Bot added documentation Improvements or additions to documentation spark native core labels Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core documentation Improvements or additions to documentation native spark

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Java codegen, fusion, and subexpression reuse for Spark expression fallback on Arrow

1 participant