MaxGekk opened a new pull request #32035:
URL: https://github.com/apache/spark/pull/32035


   ### What changes were proposed in this pull request?
   In the PR, I propose to disable ANSI intervals as the result of 
dates/timestamp subtraction in `ExtractBenchmark` and benchmark only legacy 
intervals because `EXTRACT( .. FROM ..)` doesn't support ANSI intervals so far.
   
   ### Why are the changes needed?
   This fixes the benchmark failure:
   ```
   [info]   Running case: YEAR of interval
   [error] Exception in thread "main" org.apache.spark.sql.AnalysisException: 
cannot resolve 'year((subtractdates(CAST(timestamp_seconds(id) AS DATE), DATE 
'0001-01-01') + subtracttimestamps(timestamp_seconds(id), TIMESTAMP '1000-01-01 
01:02:03.123456')))' due to data type mismatch: argument 1 requires date type, 
however, '(subtractdates(CAST(timestamp_seconds(id) AS DATE), DATE 
'0001-01-01') + subtracttimestamps(timestamp_seconds(id), TIMESTAMP '1000-01-01 
01:02:03.123456'))' is of day-time interval type.; line 1 pos 0;
   [error] 'Project [extract(YEAR, 
(subtractdates(cast(timestamp_seconds(id#1456L) as date), 0001-01-01, false) + 
subtracttimestamps(timestamp_seconds(id#1456L), 1000-01-01 01:02:03.123456, 
false, Some(Europe/Moscow)))) AS YEAR#1458]
   [error] +- Range (1262304000, 1272304000, step=1, splits=Some(1))
   [error]      at 
org.apache.spark.sql.catalyst.analysis.package$AnalysisErrorAt.failAnalysis(package.scala:42)
   [error]      at 
org.apache.spark.sql.catalyst.analysis.CheckAnalysis$$anonfun$$nestedInanonfun$checkAnalysis$1$2.applyOrElse(CheckAnalysis.scala:194)
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   ### How was this patch tested?
   By running the `ExtractBenchmark` benchmark via:
   ```
   $ build/sbt "sql/test:runMain 
org.apache.spark.sql.execution.benchmark.ExtractBenchmark"
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to