-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-34677][SQL] Support the +/- operators over ANSI SQL intervals
#31789
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
Changes from 4 commits
a5fc2c1
5bb4b7c
18b1db3
0a202f3
fc4a76d
9a086f3
3994b69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |||
| package org.apache.spark.sql | ||||
|
|
||||
| import java.sql.{Date, Timestamp} | ||||
| import java.time.{Duration, Period} | ||||
| import java.util.Locale | ||||
|
|
||||
| import org.apache.hadoop.io.{LongWritable, Text} | ||||
|
|
@@ -2375,4 +2376,16 @@ class ColumnExpressionSuite extends QueryTest with SharedSparkSession { | |||
| assert(e2.getCause.isInstanceOf[RuntimeException]) | ||||
| assert(e2.getCause.getMessage == "hello") | ||||
| } | ||||
|
|
||||
| test("SPARK-34677: negate/add/subtract year-month and day-time intervals") { | ||||
| import testImplicits._ | ||||
| val df = Seq((Period.ofMonths(10), Duration.ofDays(10), Period.ofMonths(1), Duration.ofDays(1))) | ||||
| .toDF("year-month-A", "day-time-A", "year-month-B", "day-time-B") | ||||
| val negatedDF = df.select(-$"year-month-A", -$"day-time-A") | ||||
| checkAnswer(negatedDF, Row(Period.ofMonths(-10), Duration.ofDays(-10))) | ||||
| val sumDF = df.select($"year-month-A" + $"year-month-B", $"day-time-A" + $"day-time-B") | ||||
|
||||
| override def inputTypes: Seq[AbstractDataType] = Seq(NumericType) |
+/-.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened the JIRA SPARK-34716 to don't forget about it.
Uh oh!
There was an error while loading. Please reload this page.