delta
delta copied to clipboard
[Spark] Fix time option evaluation
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
cc @scottsand-db
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.