Skip to content

[AURON #2331] Detect unexpected fallback in expression tests#2332

Open
weimingdiit wants to merge 3 commits into
apache:masterfrom
weimingdiit:feat/expression-no-fallback
Open

[AURON #2331] Detect unexpected fallback in expression tests#2332
weimingdiit wants to merge 3 commits into
apache:masterfrom
weimingdiit:feat/expression-no-fallback

Conversation

@weimingdiit

@weimingdiit weimingdiit commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #2331

Rationale for this change

Expression tests currently validate result correctness, but they do not fail when a supported expression unexpectedly falls back to Spark execution. This can hide native expression conversion regressions because Spark may still produce the correct result.

Auron should verify that expressions known to be convertible are actually offloaded to native execution.

What changes are included in this PR?

This PR adds a conservative no-fallback check to SparkExpressionTestsBase.

The new check:

  • verifies whether the executed plan contains NativeProjectBase
  • uses NativeConverters.convertExpr to decide whether an expression is expected to be convertible
  • fails only when a convertible expression falls back unexpectedly
  • keeps unsupported expressions on the existing result-only validation path
  • adds an override hook for suites to allow known fallback cases

Are there any user-facing changes?

No.

How was this patch tested?

UT.

Signed-off-by: weimingdiit <weimingdiit@gmail.com>
Signed-off-by: weimingdiit <weimingdiit@gmail.com>
Signed-off-by: weimingdiit <weimingdiit@gmail.com>
@weimingdiit weimingdiit marked this pull request as ready for review June 16, 2026 03:46
@cxzl25 cxzl25 requested a review from Copilot June 16, 2026 04:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR strengthens Auron’s Spark expression test framework by asserting that expressions expected to run natively do not silently fall back to vanilla Spark execution, helping catch native expression conversion regressions earlier.

Changes:

  • Adds a no-fallback assertion path in SparkExpressionTestsBase when the executed plan is not offloaded.
  • Uses NativeConverters to refine supported data type checks and to decide when fallback should be considered unexpected.
  • Introduces an overridable hook to allow known/intentional fallback cases in specific suites.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +303 to +312
private def canConvertExpressionToNative(expression: Expression): Boolean = {
try {
NativeConverters.convertExpr(expression)
true
} catch {
case _: NotImplementedError => false
case _: AssertionError => false
case NonFatal(_) => false
}
}
Comment on lines +286 to +288
protected def allowNativeExpressionFallback(expression: Expression): Boolean = {
Set.empty[Expression].contains(expression)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expression tests should detect unexpected fallback for supported native expressions

2 participants