Skip to content

[AURON #2713] Add native support for Spark to_unix_timestamp - #2720

Open
Sigma-Ma wants to merge 1 commit into
apache:masterfrom
Sigma-Ma:Auron-2713-add-native-support-for-spark-to-unix-timestamp
Open

Sigma-Ma wants to merge 1 commit into
apache:masterfrom
Sigma-Ma:Auron-2713-add-native-support-for-spark-to-unix-timestamp

Conversation

@Sigma-Ma

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #2713

Rationale for this change

to_unix_timestamp currently falls back to Spark. Add native execution for supported inputs while preserving Spark's parsing, timezone and error behavior.

What changes are included in this PR?

  • Add an independent Spark implementation and expression conversion for to_unix_timestamp.
  • Support TIMESTAMP inputs and DATE inputs in fixed-offset time zones, preserving truncation toward zero and ignoring the format argument.
  • Support STRING inputs on Spark 3.2+ with the CORRECTED parser policy, supported constant formats and fixed-offset time zones.
  • Keep STRING inputs on Spark 3.0/3.1 and other unsupported cases on Spark fallback.
  • Add Rust and Spark regression coverage for nulls, fractional seconds, lowercase t, ANSI behavior, overflow and execution paths.

Are there any user-facing changes?

Yes. Supported to_unix_timestamp expressions can execute natively when spark.auron.enableNativeDateTimeFunctions is enabled. Unsupported cases continue to use Spark.

How was this patch tested?

# JDK 8
./build/mvn -B -ntp -Ppre,spark-3.0,scala-2.12 -pl spark-extension-shims-spark -DskipBuildNative -Dsuites=org.apache.auron.AuronToUnixTimestampSuite,org.apache.auron.NativeConvertersSuite test

./build/mvn -B -ntp -Ppre,spark-3.1,scala-2.12 -pl spark-extension-shims-spark -DskipBuildNative -Dsuites=org.apache.auron.AuronToUnixTimestampSuite,org.apache.auron.NativeConvertersSuite test

./build/mvn -B -ntp -Ppre,spark-3.5,scala-2.12 -pl spark-extension-shims-spark -DskipBuildNative -Dsuites=org.apache.auron.AuronToUnixTimestampSuite,org.apache.auron.NativeConvertersSuite test

# JDK 17
./build/mvn -B -ntp -Ppre,spark-4.0,scala-2.13 -pl spark-extension-shims-spark -DskipBuildNative -Dsuites=org.apache.auron.AuronToUnixTimestampSuite,org.apache.auron.NativeConvertersSuite test

./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.

Add native support for Spark to_unix_timestamp

1 participant