delta icon indicating copy to clipboard operation
delta copied to clipboard

[Spark] Fix time option evaluation

Open cloud-fan opened this issue 1 year ago • 1 comments

Which Delta project/connector is this regarding?

  • [x] Spark
  • [ ] Standalone
  • [ ] Flink
  • [ ] Kernel
  • [ ] Other (fill in here)

Description

We made a fix to evaluate current datetime functions for Delta options. However, the fix is not completed as it doesn't handle data types other than TimestampType. This PR fixes it.

How was this patch tested?

A new test

Does this PR introduce any user-facing changes?

Yes, before the fix, Delta throws [INTERNAL_ERROR] Cannot evaluate expression

cloud-fan avatar May 01 '24 02:05 cloud-fan

cc @scottsand-db

cloud-fan avatar May 01 '24 02:05 cloud-fan

Fails Spark Master Tests

https://github.com/delta-io/delta/actions/runs/8983897145/job/24674590454?pr=2999

[info] - changes - start and end are timestamps *** FAILED ***
[info]   java.lang.NumberFormatException: For input string: "string(current_date())"
[info]   at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
[info] - changes - start and end are timestamps *** FAILED ***
[info]   java.lang.NumberFormatException: For input string: "string(current_date())"
[info]   at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
[info] - changes - start and end are timestamps *** FAILED ***
[info]   org.apache.spark.sql.delta.DeltaAnalysisException: [DELTA_TIMESTAMP_GREATER_THAN_COMMIT] The provided timestamp (2024-05-07 00:00:00.0) is after the latest version available to this
[info] table (1969-12-31 16:00:02.0). Please use a timestamp before or at 1969-12-31 16:00:02.
[info]   at org.apache.spark.sql.delta.DeltaErrorsBase.timestampGreaterThanLatestCommit(DeltaErrors.scala:1367)

Fails Spark 3.5 Tests

https://github.com/delta-io/delta/actions/runs/8983897146/job/24674591077?pr=2999

[info] - changes - start and end are timestamps *** FAILED ***
[info]   java.lang.NumberFormatException: For input string: "string(current_date())"
[info]   at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
[info] - changes - start and end are timestamps *** FAILED ***
[info]   java.lang.NumberFormatException: For input string: "string(current_date())"
[info]   at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
[info] - changes - start and end are timestamps *** FAILED ***
[info]   org.apache.spark.sql.delta.DeltaAnalysisException: [DELTA_TIMESTAMP_GREATER_THAN_COMMIT] The provided timestamp (2024-05-07 00:00:00.0) is after the latest version available to this
[info] table (1969-12-31 16:00:02.0). Please use a timestamp before or at 1969-12-31 16:00:02.

scottsand-db avatar May 07 '24 16:05 scottsand-db