Skip to content

[AURON #2529] Support add_months function natively - #2533

Open
Sigma-Ma wants to merge 1 commit into
apache:masterfrom
Sigma-Ma:Auron-2529-support-add-months-natively
Open

Sigma-Ma wants to merge 1 commit into
apache:masterfrom
Sigma-Ma:Auron-2529-support-add-months-natively

Conversation

@Sigma-Ma

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #2529

Rationale for this change

Spark add_months expressions fall back to Spark because AddMonths has no native conversion.

What changes are included in this PR?

  • Convert AddMonths to the Spark_AddMonths extension function.
  • Reuse Chrono's month arithmetic, with Gregorian cycle reduction to support the full Date32 range.
  • Preserve null propagation, month-end adjustment, and version-specific overflow behavior: wrapping in Spark 3.0 and errors in Spark 3.1+.
  • Add Rust and Spark regression tests for month arithmetic, scalar and column inputs, date boundaries, overflow, and timestamp-to-date conversion. Spark tests also check native execution.

Are there any user-facing changes?

add_months can now run natively. SQL syntax and result semantics are unchanged.

How was this patch tested?

  • cargo test -p datafusion-ext-functions spark_dates::tests::test_spark_add_months --locked.
  • ./build/mvn -Ppre -Pspark-3.5 -Pscala-2.12 -pl spark-extension-shims-spark -am install -DskipTests.
  • ./build/mvn -Ppre -Pspark-3.5 -Pscala-2.12 -pl spark-extension-shims-spark test -DskipBuildNative -Dsuites=org.apache.auron.AuronFunctionSuite.
  • ./dev/reformat --check.

Was this patch authored or co-authored using generative AI tooling?

  • Yes
  • No

Generated-by: OpenAI Codex (GPT-6)

ASF guidance: https://www.apache.org/legal/generative-tooling.html

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.

Support add_months function natively

1 participant