Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-34938][SQL][TESTS] Benchmark only legacy interval in ExtractBenchmark #32035

Closed
wants to merge 1 commit into from

Conversation

MaxGekk
Copy link
Member

@MaxGekk MaxGekk commented Apr 2, 2021

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"

@github-actions github-actions bot added the SQL label Apr 2, 2021
@MaxGekk MaxGekk changed the title [SPARK-34938][SQL] Benchmark only legacy interval in ExtractBenchmark [SPARK-34938][SQL][TESTS] Benchmark only legacy interval in ExtractBenchmark Apr 2, 2021
@MaxGekk
Copy link
Member Author

MaxGekk commented Apr 2, 2021

@HyukjinKwon Could you review this PR, please.

withSQLConf(SQLConf.WHOLESTAGE_CODEGEN_ENABLED.key -> "true") {
withSQLConf(
SQLConf.LEGACY_INTERVAL_ENABLED.key -> "true",
SQLConf.WHOLESTAGE_CODEGEN_ENABLED.key -> "true") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, I asked (offline) to don't generate the benchmark results because I plan to regenerate everything after #32015

@HyukjinKwon
Copy link
Member

None of tests actually verfiies this changes except comliation and linter which passed.

Merged to master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants