This is an automated email from the ASF dual-hosted git repository. maxgekk pushed a commit to branch branch-3.3 in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.3 by this push: new 28f7d95 [SPARK-38600][SQL] Include `unit` into the sql string of `TIMESTAMPADD/DIFF` 28f7d95 is described below commit 28f7d955c9125ccedb3b5b4ff0f97ac283fbcc88 Author: Max Gekk <max.g...@gmail.com> AuthorDate: Fri Mar 18 21:01:31 2022 +0300 [SPARK-38600][SQL] Include `unit` into the sql string of `TIMESTAMPADD/DIFF` ### What changes were proposed in this pull request? In the PR, I propose to override the `sql()` method of the `TIMESTAMPADD` and `TIMESTAMPDIFF` expression to include `unit` as the first parameter of the functions. ### Why are the changes needed? To improve user experience with Spark SQL. ### Does this PR introduce _any_ user-facing change? Yes. ### How was this patch tested? By running the test suites: ``` $ build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite -- -z timestamp.sql" $ build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite -- -z timestamp-ansi.sql" $ build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite -- -z datetime-legacy.sql" $ build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite -- -z timestamp-ntz.sql" ``` Closes #35911 from MaxGekk/timestampadd-unit-in-schema. Authored-by: Max Gekk <max.g...@gmail.com> Signed-off-by: Max Gekk <max.g...@gmail.com> (cherry picked from commit 53eaaf867c3849e01ea19840820bbdfc031e5606) Signed-off-by: Max Gekk <max.g...@gmail.com> --- .../catalyst/expressions/datetimeExpressions.scala | 10 ++++ .../resources/sql-tests/results/ansi/date.sql.out | 40 ++++++++-------- .../sql-tests/results/ansi/timestamp.sql.out | 16 +++---- .../test/resources/sql-tests/results/date.sql.out | 40 ++++++++-------- .../sql-tests/results/datetime-legacy.sql.out | 56 +++++++++++----------- .../sql-tests/results/timestamp-ntz.sql.out | 8 ++-- .../resources/sql-tests/results/timestamp.sql.out | 16 +++---- .../results/timestampNTZ/timestamp-ansi.sql.out | 16 +++---- .../results/timestampNTZ/timestamp.sql.out | 16 +++---- 9 files changed, 114 insertions(+), 104 deletions(-) diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala index 15ab3a2..fbc670f 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala @@ -3121,6 +3121,11 @@ case class TimestampAdd( override def prettyName: String = "timestampadd" + override def sql: String = { + val childrenSQL = (unit +: children.map(_.sql)).mkString(", ") + s"$prettyName($childrenSQL)" + } + override protected def withNewChildrenInternal( newLeft: Expression, newRight: Expression): TimestampAdd = { @@ -3203,6 +3208,11 @@ case class TimestampDiff( override def prettyName: String = "timestampdiff" + override def sql: String = { + val childrenSQL = (unit +: children.map(_.sql)).mkString(", ") + s"$prettyName($childrenSQL)" + } + override protected def withNewChildrenInternal( newLeft: Expression, newRight: Expression): TimestampDiff = { diff --git a/sql/core/src/test/resources/sql-tests/results/ansi/date.sql.out b/sql/core/src/test/resources/sql-tests/results/ansi/date.sql.out index 437b56e..98b1ec4 100644 --- a/sql/core/src/test/resources/sql-tests/results/ansi/date.sql.out +++ b/sql/core/src/test/resources/sql-tests/results/ansi/date.sql.out @@ -665,7 +665,7 @@ You may get a different result due to the upgrading to Spark >= 3.0: Fail to rec -- !query select dateadd(MICROSECOND, 1001, timestamp'2022-02-25 01:02:03.123') -- !query schema -struct<timestampadd(1001, TIMESTAMP '2022-02-25 01:02:03.123'):timestamp> +struct<timestampadd(MICROSECOND, 1001, TIMESTAMP '2022-02-25 01:02:03.123'):timestamp> -- !query output 2022-02-25 01:02:03.124001 @@ -673,7 +673,7 @@ struct<timestampadd(1001, TIMESTAMP '2022-02-25 01:02:03.123'):timestamp> -- !query select dateadd(MILLISECOND, -1, timestamp'2022-02-25 01:02:03.456') -- !query schema -struct<timestampadd(-1, TIMESTAMP '2022-02-25 01:02:03.456'):timestamp> +struct<timestampadd(MILLISECOND, -1, TIMESTAMP '2022-02-25 01:02:03.456'):timestamp> -- !query output 2022-02-25 01:02:03.455 @@ -681,7 +681,7 @@ struct<timestampadd(-1, TIMESTAMP '2022-02-25 01:02:03.456'):timestamp> -- !query select dateadd(SECOND, 58, timestamp'2022-02-25 01:02:03') -- !query schema -struct<timestampadd(58, TIMESTAMP '2022-02-25 01:02:03'):timestamp> +struct<timestampadd(SECOND, 58, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query output 2022-02-25 01:03:01 @@ -689,7 +689,7 @@ struct<timestampadd(58, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query select dateadd(MINUTE, -100, date'2022-02-25') -- !query schema -struct<timestampadd(-100, DATE '2022-02-25'):timestamp> +struct<timestampadd(MINUTE, -100, DATE '2022-02-25'):timestamp> -- !query output 2022-02-24 22:20:00 @@ -697,7 +697,7 @@ struct<timestampadd(-100, DATE '2022-02-25'):timestamp> -- !query select dateadd(HOUR, -1, timestamp'2022-02-25 01:02:03') -- !query schema -struct<timestampadd(-1, TIMESTAMP '2022-02-25 01:02:03'):timestamp> +struct<timestampadd(HOUR, -1, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query output 2022-02-25 00:02:03 @@ -705,7 +705,7 @@ struct<timestampadd(-1, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query select dateadd(DAY, 367, date'2022-02-25') -- !query schema -struct<timestampadd(367, DATE '2022-02-25'):timestamp> +struct<timestampadd(DAY, 367, DATE '2022-02-25'):timestamp> -- !query output 2023-02-27 00:00:00 @@ -713,7 +713,7 @@ struct<timestampadd(367, DATE '2022-02-25'):timestamp> -- !query select dateadd(WEEK, -4, timestamp'2022-02-25 01:02:03') -- !query schema -struct<timestampadd(-4, TIMESTAMP '2022-02-25 01:02:03'):timestamp> +struct<timestampadd(WEEK, -4, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query output 2022-01-28 01:02:03 @@ -721,7 +721,7 @@ struct<timestampadd(-4, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query select dateadd(MONTH, -1, timestamp'2022-02-25 01:02:03') -- !query schema -struct<timestampadd(-1, TIMESTAMP '2022-02-25 01:02:03'):timestamp> +struct<timestampadd(MONTH, -1, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query output 2022-01-25 01:02:03 @@ -729,7 +729,7 @@ struct<timestampadd(-1, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query select dateadd(QUARTER, 5, date'2022-02-25') -- !query schema -struct<timestampadd(5, DATE '2022-02-25'):timestamp> +struct<timestampadd(QUARTER, 5, DATE '2022-02-25'):timestamp> -- !query output 2023-05-25 00:00:00 @@ -737,7 +737,7 @@ struct<timestampadd(5, DATE '2022-02-25'):timestamp> -- !query select dateadd(YEAR, 1, date'2022-02-25') -- !query schema -struct<timestampadd(1, DATE '2022-02-25'):timestamp> +struct<timestampadd(YEAR, 1, DATE '2022-02-25'):timestamp> -- !query output 2023-02-25 00:00:00 @@ -745,7 +745,7 @@ struct<timestampadd(1, DATE '2022-02-25'):timestamp> -- !query select datediff(MICROSECOND, timestamp'2022-02-25 01:02:03.123', timestamp'2022-02-25 01:02:03.124001') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03.123', TIMESTAMP '2022-02-25 01:02:03.124001'):bigint> +struct<timestampdiff(MICROSECOND, TIMESTAMP '2022-02-25 01:02:03.123', TIMESTAMP '2022-02-25 01:02:03.124001'):bigint> -- !query output 1001 @@ -753,7 +753,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03.123', TIMESTAMP '2022-02-25 -- !query select datediff(MILLISECOND, timestamp'2022-02-25 01:02:03.456', timestamp'2022-02-25 01:02:03.455') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03.456', TIMESTAMP '2022-02-25 01:02:03.455'):bigint> +struct<timestampdiff(MILLISECOND, TIMESTAMP '2022-02-25 01:02:03.456', TIMESTAMP '2022-02-25 01:02:03.455'):bigint> -- !query output -1 @@ -761,7 +761,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03.456', TIMESTAMP '2022-02-25 -- !query select datediff(SECOND, timestamp'2022-02-25 01:02:03', timestamp'2022-02-25 01:03:01') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-02-25 01:03:01'):bigint> +struct<timestampdiff(SECOND, TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-02-25 01:03:01'):bigint> -- !query output 58 @@ -769,7 +769,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-02-25 01:0 -- !query select datediff(MINUTE, date'2022-02-25', timestamp'2022-02-24 22:20:00') -- !query schema -struct<timestampdiff(DATE '2022-02-25', TIMESTAMP '2022-02-24 22:20:00'):bigint> +struct<timestampdiff(MINUTE, DATE '2022-02-25', TIMESTAMP '2022-02-24 22:20:00'):bigint> -- !query output -100 @@ -777,7 +777,7 @@ struct<timestampdiff(DATE '2022-02-25', TIMESTAMP '2022-02-24 22:20:00'):bigint> -- !query select datediff(HOUR, timestamp'2022-02-25 01:02:03', timestamp'2022-02-25 00:02:03') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-02-25 00:02:03'):bigint> +struct<timestampdiff(HOUR, TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-02-25 00:02:03'):bigint> -- !query output -1 @@ -785,7 +785,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-02-25 00:0 -- !query select datediff(DAY, date'2022-02-25', timestamp'2023-02-27 00:00:00') -- !query schema -struct<timestampdiff(DATE '2022-02-25', TIMESTAMP '2023-02-27 00:00:00'):bigint> +struct<timestampdiff(DAY, DATE '2022-02-25', TIMESTAMP '2023-02-27 00:00:00'):bigint> -- !query output 367 @@ -793,7 +793,7 @@ struct<timestampdiff(DATE '2022-02-25', TIMESTAMP '2023-02-27 00:00:00'):bigint> -- !query select datediff(WEEK, timestamp'2022-02-25 01:02:03', timestamp'2022-01-28 01:02:03') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-01-28 01:02:03'):bigint> +struct<timestampdiff(WEEK, TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-01-28 01:02:03'):bigint> -- !query output -4 @@ -801,7 +801,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-01-28 01:0 -- !query select datediff(MONTH, timestamp'2022-02-25 01:02:03', timestamp'2022-01-25 01:02:03') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-01-25 01:02:03'):bigint> +struct<timestampdiff(MONTH, TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-01-25 01:02:03'):bigint> -- !query output -1 @@ -809,7 +809,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-01-25 01:0 -- !query select datediff(QUARTER, date'2022-02-25', date'2023-05-25') -- !query schema -struct<timestampdiff(DATE '2022-02-25', DATE '2023-05-25'):bigint> +struct<timestampdiff(QUARTER, DATE '2022-02-25', DATE '2023-05-25'):bigint> -- !query output 5 @@ -817,6 +817,6 @@ struct<timestampdiff(DATE '2022-02-25', DATE '2023-05-25'):bigint> -- !query select datediff(YEAR, date'2022-02-25', date'2023-02-25') -- !query schema -struct<timestampdiff(DATE '2022-02-25', DATE '2023-02-25'):bigint> +struct<timestampdiff(YEAR, DATE '2022-02-25', DATE '2023-02-25'):bigint> -- !query output 1 diff --git a/sql/core/src/test/resources/sql-tests/results/ansi/timestamp.sql.out b/sql/core/src/test/resources/sql-tests/results/ansi/timestamp.sql.out index 1bd579e..cf6af94 100644 --- a/sql/core/src/test/resources/sql-tests/results/ansi/timestamp.sql.out +++ b/sql/core/src/test/resources/sql-tests/results/ansi/timestamp.sql.out @@ -784,7 +784,7 @@ You may get a different result due to the upgrading to Spark >= 3.0: Fail to rec -- !query select timestampadd(MONTH, -1, timestamp'2022-02-14 01:02:03') -- !query schema -struct<timestampadd(-1, TIMESTAMP '2022-02-14 01:02:03'):timestamp> +struct<timestampadd(MONTH, -1, TIMESTAMP '2022-02-14 01:02:03'):timestamp> -- !query output 2022-01-14 01:02:03 @@ -792,7 +792,7 @@ struct<timestampadd(-1, TIMESTAMP '2022-02-14 01:02:03'):timestamp> -- !query select timestampadd(MINUTE, 58, timestamp'2022-02-14 01:02:03') -- !query schema -struct<timestampadd(58, TIMESTAMP '2022-02-14 01:02:03'):timestamp> +struct<timestampadd(MINUTE, 58, TIMESTAMP '2022-02-14 01:02:03'):timestamp> -- !query output 2022-02-14 02:00:03 @@ -800,7 +800,7 @@ struct<timestampadd(58, TIMESTAMP '2022-02-14 01:02:03'):timestamp> -- !query select timestampadd(YEAR, 1, date'2022-02-15') -- !query schema -struct<timestampadd(1, DATE '2022-02-15'):timestamp> +struct<timestampadd(YEAR, 1, DATE '2022-02-15'):timestamp> -- !query output 2023-02-15 00:00:00 @@ -808,7 +808,7 @@ struct<timestampadd(1, DATE '2022-02-15'):timestamp> -- !query select timestampadd(SECOND, -1, date'2022-02-15') -- !query schema -struct<timestampadd(-1, DATE '2022-02-15'):timestamp> +struct<timestampadd(SECOND, -1, DATE '2022-02-15'):timestamp> -- !query output 2022-02-14 23:59:59 @@ -816,7 +816,7 @@ struct<timestampadd(-1, DATE '2022-02-15'):timestamp> -- !query select timestampdiff(MONTH, timestamp'2022-02-14 01:02:03', timestamp'2022-01-14 01:02:03') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-14 01:02:03', TIMESTAMP '2022-01-14 01:02:03'):bigint> +struct<timestampdiff(MONTH, TIMESTAMP '2022-02-14 01:02:03', TIMESTAMP '2022-01-14 01:02:03'):bigint> -- !query output -1 @@ -824,7 +824,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-14 01:02:03', TIMESTAMP '2022-01-14 01:0 -- !query select timestampdiff(MINUTE, timestamp'2022-02-14 01:02:03', timestamp'2022-02-14 02:00:03') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-14 01:02:03', TIMESTAMP '2022-02-14 02:00:03'):bigint> +struct<timestampdiff(MINUTE, TIMESTAMP '2022-02-14 01:02:03', TIMESTAMP '2022-02-14 02:00:03'):bigint> -- !query output 58 @@ -832,7 +832,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-14 01:02:03', TIMESTAMP '2022-02-14 02:0 -- !query select timestampdiff(YEAR, date'2022-02-15', date'2023-02-15') -- !query schema -struct<timestampdiff(DATE '2022-02-15', DATE '2023-02-15'):bigint> +struct<timestampdiff(YEAR, DATE '2022-02-15', DATE '2023-02-15'):bigint> -- !query output 1 @@ -840,6 +840,6 @@ struct<timestampdiff(DATE '2022-02-15', DATE '2023-02-15'):bigint> -- !query select timestampdiff(SECOND, date'2022-02-15', timestamp'2022-02-14 23:59:59') -- !query schema -struct<timestampdiff(DATE '2022-02-15', TIMESTAMP '2022-02-14 23:59:59'):bigint> +struct<timestampdiff(SECOND, DATE '2022-02-15', TIMESTAMP '2022-02-14 23:59:59'):bigint> -- !query output -1 diff --git a/sql/core/src/test/resources/sql-tests/results/date.sql.out b/sql/core/src/test/resources/sql-tests/results/date.sql.out index 91c89ef..83f59cb 100644 --- a/sql/core/src/test/resources/sql-tests/results/date.sql.out +++ b/sql/core/src/test/resources/sql-tests/results/date.sql.out @@ -664,7 +664,7 @@ You may get a different result due to the upgrading to Spark >= 3.0: Fail to rec -- !query select dateadd(MICROSECOND, 1001, timestamp'2022-02-25 01:02:03.123') -- !query schema -struct<timestampadd(1001, TIMESTAMP '2022-02-25 01:02:03.123'):timestamp> +struct<timestampadd(MICROSECOND, 1001, TIMESTAMP '2022-02-25 01:02:03.123'):timestamp> -- !query output 2022-02-25 01:02:03.124001 @@ -672,7 +672,7 @@ struct<timestampadd(1001, TIMESTAMP '2022-02-25 01:02:03.123'):timestamp> -- !query select dateadd(MILLISECOND, -1, timestamp'2022-02-25 01:02:03.456') -- !query schema -struct<timestampadd(-1, TIMESTAMP '2022-02-25 01:02:03.456'):timestamp> +struct<timestampadd(MILLISECOND, -1, TIMESTAMP '2022-02-25 01:02:03.456'):timestamp> -- !query output 2022-02-25 01:02:03.455 @@ -680,7 +680,7 @@ struct<timestampadd(-1, TIMESTAMP '2022-02-25 01:02:03.456'):timestamp> -- !query select dateadd(SECOND, 58, timestamp'2022-02-25 01:02:03') -- !query schema -struct<timestampadd(58, TIMESTAMP '2022-02-25 01:02:03'):timestamp> +struct<timestampadd(SECOND, 58, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query output 2022-02-25 01:03:01 @@ -688,7 +688,7 @@ struct<timestampadd(58, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query select dateadd(MINUTE, -100, date'2022-02-25') -- !query schema -struct<timestampadd(-100, DATE '2022-02-25'):timestamp> +struct<timestampadd(MINUTE, -100, DATE '2022-02-25'):timestamp> -- !query output 2022-02-24 22:20:00 @@ -696,7 +696,7 @@ struct<timestampadd(-100, DATE '2022-02-25'):timestamp> -- !query select dateadd(HOUR, -1, timestamp'2022-02-25 01:02:03') -- !query schema -struct<timestampadd(-1, TIMESTAMP '2022-02-25 01:02:03'):timestamp> +struct<timestampadd(HOUR, -1, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query output 2022-02-25 00:02:03 @@ -704,7 +704,7 @@ struct<timestampadd(-1, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query select dateadd(DAY, 367, date'2022-02-25') -- !query schema -struct<timestampadd(367, DATE '2022-02-25'):timestamp> +struct<timestampadd(DAY, 367, DATE '2022-02-25'):timestamp> -- !query output 2023-02-27 00:00:00 @@ -712,7 +712,7 @@ struct<timestampadd(367, DATE '2022-02-25'):timestamp> -- !query select dateadd(WEEK, -4, timestamp'2022-02-25 01:02:03') -- !query schema -struct<timestampadd(-4, TIMESTAMP '2022-02-25 01:02:03'):timestamp> +struct<timestampadd(WEEK, -4, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query output 2022-01-28 01:02:03 @@ -720,7 +720,7 @@ struct<timestampadd(-4, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query select dateadd(MONTH, -1, timestamp'2022-02-25 01:02:03') -- !query schema -struct<timestampadd(-1, TIMESTAMP '2022-02-25 01:02:03'):timestamp> +struct<timestampadd(MONTH, -1, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query output 2022-01-25 01:02:03 @@ -728,7 +728,7 @@ struct<timestampadd(-1, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query select dateadd(QUARTER, 5, date'2022-02-25') -- !query schema -struct<timestampadd(5, DATE '2022-02-25'):timestamp> +struct<timestampadd(QUARTER, 5, DATE '2022-02-25'):timestamp> -- !query output 2023-05-25 00:00:00 @@ -736,7 +736,7 @@ struct<timestampadd(5, DATE '2022-02-25'):timestamp> -- !query select dateadd(YEAR, 1, date'2022-02-25') -- !query schema -struct<timestampadd(1, DATE '2022-02-25'):timestamp> +struct<timestampadd(YEAR, 1, DATE '2022-02-25'):timestamp> -- !query output 2023-02-25 00:00:00 @@ -744,7 +744,7 @@ struct<timestampadd(1, DATE '2022-02-25'):timestamp> -- !query select datediff(MICROSECOND, timestamp'2022-02-25 01:02:03.123', timestamp'2022-02-25 01:02:03.124001') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03.123', TIMESTAMP '2022-02-25 01:02:03.124001'):bigint> +struct<timestampdiff(MICROSECOND, TIMESTAMP '2022-02-25 01:02:03.123', TIMESTAMP '2022-02-25 01:02:03.124001'):bigint> -- !query output 1001 @@ -752,7 +752,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03.123', TIMESTAMP '2022-02-25 -- !query select datediff(MILLISECOND, timestamp'2022-02-25 01:02:03.456', timestamp'2022-02-25 01:02:03.455') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03.456', TIMESTAMP '2022-02-25 01:02:03.455'):bigint> +struct<timestampdiff(MILLISECOND, TIMESTAMP '2022-02-25 01:02:03.456', TIMESTAMP '2022-02-25 01:02:03.455'):bigint> -- !query output -1 @@ -760,7 +760,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03.456', TIMESTAMP '2022-02-25 -- !query select datediff(SECOND, timestamp'2022-02-25 01:02:03', timestamp'2022-02-25 01:03:01') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-02-25 01:03:01'):bigint> +struct<timestampdiff(SECOND, TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-02-25 01:03:01'):bigint> -- !query output 58 @@ -768,7 +768,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-02-25 01:0 -- !query select datediff(MINUTE, date'2022-02-25', timestamp'2022-02-24 22:20:00') -- !query schema -struct<timestampdiff(DATE '2022-02-25', TIMESTAMP '2022-02-24 22:20:00'):bigint> +struct<timestampdiff(MINUTE, DATE '2022-02-25', TIMESTAMP '2022-02-24 22:20:00'):bigint> -- !query output -100 @@ -776,7 +776,7 @@ struct<timestampdiff(DATE '2022-02-25', TIMESTAMP '2022-02-24 22:20:00'):bigint> -- !query select datediff(HOUR, timestamp'2022-02-25 01:02:03', timestamp'2022-02-25 00:02:03') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-02-25 00:02:03'):bigint> +struct<timestampdiff(HOUR, TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-02-25 00:02:03'):bigint> -- !query output -1 @@ -784,7 +784,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-02-25 00:0 -- !query select datediff(DAY, date'2022-02-25', timestamp'2023-02-27 00:00:00') -- !query schema -struct<timestampdiff(DATE '2022-02-25', TIMESTAMP '2023-02-27 00:00:00'):bigint> +struct<timestampdiff(DAY, DATE '2022-02-25', TIMESTAMP '2023-02-27 00:00:00'):bigint> -- !query output 367 @@ -792,7 +792,7 @@ struct<timestampdiff(DATE '2022-02-25', TIMESTAMP '2023-02-27 00:00:00'):bigint> -- !query select datediff(WEEK, timestamp'2022-02-25 01:02:03', timestamp'2022-01-28 01:02:03') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-01-28 01:02:03'):bigint> +struct<timestampdiff(WEEK, TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-01-28 01:02:03'):bigint> -- !query output -4 @@ -800,7 +800,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-01-28 01:0 -- !query select datediff(MONTH, timestamp'2022-02-25 01:02:03', timestamp'2022-01-25 01:02:03') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-01-25 01:02:03'):bigint> +struct<timestampdiff(MONTH, TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-01-25 01:02:03'):bigint> -- !query output -1 @@ -808,7 +808,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-01-25 01:0 -- !query select datediff(QUARTER, date'2022-02-25', date'2023-05-25') -- !query schema -struct<timestampdiff(DATE '2022-02-25', DATE '2023-05-25'):bigint> +struct<timestampdiff(QUARTER, DATE '2022-02-25', DATE '2023-05-25'):bigint> -- !query output 5 @@ -816,6 +816,6 @@ struct<timestampdiff(DATE '2022-02-25', DATE '2023-05-25'):bigint> -- !query select datediff(YEAR, date'2022-02-25', date'2023-02-25') -- !query schema -struct<timestampdiff(DATE '2022-02-25', DATE '2023-02-25'):bigint> +struct<timestampdiff(YEAR, DATE '2022-02-25', DATE '2023-02-25'):bigint> -- !query output 1 diff --git a/sql/core/src/test/resources/sql-tests/results/datetime-legacy.sql.out b/sql/core/src/test/resources/sql-tests/results/datetime-legacy.sql.out index 9b00d38..03ec795 100644 --- a/sql/core/src/test/resources/sql-tests/results/datetime-legacy.sql.out +++ b/sql/core/src/test/resources/sql-tests/results/datetime-legacy.sql.out @@ -661,7 +661,7 @@ struct<from_csv(26/October/2015):struct<d:date>> -- !query select dateadd(MICROSECOND, 1001, timestamp'2022-02-25 01:02:03.123') -- !query schema -struct<timestampadd(1001, TIMESTAMP '2022-02-25 01:02:03.123'):timestamp> +struct<timestampadd(MICROSECOND, 1001, TIMESTAMP '2022-02-25 01:02:03.123'):timestamp> -- !query output 2022-02-25 01:02:03.124001 @@ -669,7 +669,7 @@ struct<timestampadd(1001, TIMESTAMP '2022-02-25 01:02:03.123'):timestamp> -- !query select dateadd(MILLISECOND, -1, timestamp'2022-02-25 01:02:03.456') -- !query schema -struct<timestampadd(-1, TIMESTAMP '2022-02-25 01:02:03.456'):timestamp> +struct<timestampadd(MILLISECOND, -1, TIMESTAMP '2022-02-25 01:02:03.456'):timestamp> -- !query output 2022-02-25 01:02:03.455 @@ -677,7 +677,7 @@ struct<timestampadd(-1, TIMESTAMP '2022-02-25 01:02:03.456'):timestamp> -- !query select dateadd(SECOND, 58, timestamp'2022-02-25 01:02:03') -- !query schema -struct<timestampadd(58, TIMESTAMP '2022-02-25 01:02:03'):timestamp> +struct<timestampadd(SECOND, 58, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query output 2022-02-25 01:03:01 @@ -685,7 +685,7 @@ struct<timestampadd(58, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query select dateadd(MINUTE, -100, date'2022-02-25') -- !query schema -struct<timestampadd(-100, DATE '2022-02-25'):timestamp> +struct<timestampadd(MINUTE, -100, DATE '2022-02-25'):timestamp> -- !query output 2022-02-24 22:20:00 @@ -693,7 +693,7 @@ struct<timestampadd(-100, DATE '2022-02-25'):timestamp> -- !query select dateadd(HOUR, -1, timestamp'2022-02-25 01:02:03') -- !query schema -struct<timestampadd(-1, TIMESTAMP '2022-02-25 01:02:03'):timestamp> +struct<timestampadd(HOUR, -1, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query output 2022-02-25 00:02:03 @@ -701,7 +701,7 @@ struct<timestampadd(-1, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query select dateadd(DAY, 367, date'2022-02-25') -- !query schema -struct<timestampadd(367, DATE '2022-02-25'):timestamp> +struct<timestampadd(DAY, 367, DATE '2022-02-25'):timestamp> -- !query output 2023-02-27 00:00:00 @@ -709,7 +709,7 @@ struct<timestampadd(367, DATE '2022-02-25'):timestamp> -- !query select dateadd(WEEK, -4, timestamp'2022-02-25 01:02:03') -- !query schema -struct<timestampadd(-4, TIMESTAMP '2022-02-25 01:02:03'):timestamp> +struct<timestampadd(WEEK, -4, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query output 2022-01-28 01:02:03 @@ -717,7 +717,7 @@ struct<timestampadd(-4, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query select dateadd(MONTH, -1, timestamp'2022-02-25 01:02:03') -- !query schema -struct<timestampadd(-1, TIMESTAMP '2022-02-25 01:02:03'):timestamp> +struct<timestampadd(MONTH, -1, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query output 2022-01-25 01:02:03 @@ -725,7 +725,7 @@ struct<timestampadd(-1, TIMESTAMP '2022-02-25 01:02:03'):timestamp> -- !query select dateadd(QUARTER, 5, date'2022-02-25') -- !query schema -struct<timestampadd(5, DATE '2022-02-25'):timestamp> +struct<timestampadd(QUARTER, 5, DATE '2022-02-25'):timestamp> -- !query output 2023-05-25 00:00:00 @@ -733,7 +733,7 @@ struct<timestampadd(5, DATE '2022-02-25'):timestamp> -- !query select dateadd(YEAR, 1, date'2022-02-25') -- !query schema -struct<timestampadd(1, DATE '2022-02-25'):timestamp> +struct<timestampadd(YEAR, 1, DATE '2022-02-25'):timestamp> -- !query output 2023-02-25 00:00:00 @@ -741,7 +741,7 @@ struct<timestampadd(1, DATE '2022-02-25'):timestamp> -- !query select datediff(MICROSECOND, timestamp'2022-02-25 01:02:03.123', timestamp'2022-02-25 01:02:03.124001') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03.123', TIMESTAMP '2022-02-25 01:02:03.124001'):bigint> +struct<timestampdiff(MICROSECOND, TIMESTAMP '2022-02-25 01:02:03.123', TIMESTAMP '2022-02-25 01:02:03.124001'):bigint> -- !query output 1001 @@ -749,7 +749,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03.123', TIMESTAMP '2022-02-25 -- !query select datediff(MILLISECOND, timestamp'2022-02-25 01:02:03.456', timestamp'2022-02-25 01:02:03.455') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03.456', TIMESTAMP '2022-02-25 01:02:03.455'):bigint> +struct<timestampdiff(MILLISECOND, TIMESTAMP '2022-02-25 01:02:03.456', TIMESTAMP '2022-02-25 01:02:03.455'):bigint> -- !query output -1 @@ -757,7 +757,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03.456', TIMESTAMP '2022-02-25 -- !query select datediff(SECOND, timestamp'2022-02-25 01:02:03', timestamp'2022-02-25 01:03:01') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-02-25 01:03:01'):bigint> +struct<timestampdiff(SECOND, TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-02-25 01:03:01'):bigint> -- !query output 58 @@ -765,7 +765,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-02-25 01:0 -- !query select datediff(MINUTE, date'2022-02-25', timestamp'2022-02-24 22:20:00') -- !query schema -struct<timestampdiff(DATE '2022-02-25', TIMESTAMP '2022-02-24 22:20:00'):bigint> +struct<timestampdiff(MINUTE, DATE '2022-02-25', TIMESTAMP '2022-02-24 22:20:00'):bigint> -- !query output -100 @@ -773,7 +773,7 @@ struct<timestampdiff(DATE '2022-02-25', TIMESTAMP '2022-02-24 22:20:00'):bigint> -- !query select datediff(HOUR, timestamp'2022-02-25 01:02:03', timestamp'2022-02-25 00:02:03') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-02-25 00:02:03'):bigint> +struct<timestampdiff(HOUR, TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-02-25 00:02:03'):bigint> -- !query output -1 @@ -781,7 +781,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-02-25 00:0 -- !query select datediff(DAY, date'2022-02-25', timestamp'2023-02-27 00:00:00') -- !query schema -struct<timestampdiff(DATE '2022-02-25', TIMESTAMP '2023-02-27 00:00:00'):bigint> +struct<timestampdiff(DAY, DATE '2022-02-25', TIMESTAMP '2023-02-27 00:00:00'):bigint> -- !query output 367 @@ -789,7 +789,7 @@ struct<timestampdiff(DATE '2022-02-25', TIMESTAMP '2023-02-27 00:00:00'):bigint> -- !query select datediff(WEEK, timestamp'2022-02-25 01:02:03', timestamp'2022-01-28 01:02:03') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-01-28 01:02:03'):bigint> +struct<timestampdiff(WEEK, TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-01-28 01:02:03'):bigint> -- !query output -4 @@ -797,7 +797,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-01-28 01:0 -- !query select datediff(MONTH, timestamp'2022-02-25 01:02:03', timestamp'2022-01-25 01:02:03') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-01-25 01:02:03'):bigint> +struct<timestampdiff(MONTH, TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-01-25 01:02:03'):bigint> -- !query output -1 @@ -805,7 +805,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-25 01:02:03', TIMESTAMP '2022-01-25 01:0 -- !query select datediff(QUARTER, date'2022-02-25', date'2023-05-25') -- !query schema -struct<timestampdiff(DATE '2022-02-25', DATE '2023-05-25'):bigint> +struct<timestampdiff(QUARTER, DATE '2022-02-25', DATE '2023-05-25'):bigint> -- !query output 5 @@ -813,7 +813,7 @@ struct<timestampdiff(DATE '2022-02-25', DATE '2023-05-25'):bigint> -- !query select datediff(YEAR, date'2022-02-25', date'2023-02-25') -- !query schema -struct<timestampdiff(DATE '2022-02-25', DATE '2023-02-25'):bigint> +struct<timestampdiff(YEAR, DATE '2022-02-25', DATE '2023-02-25'):bigint> -- !query output 1 @@ -1588,7 +1588,7 @@ struct<from_csv(26/October/2015):struct<t:timestamp>> -- !query select timestampadd(MONTH, -1, timestamp'2022-02-14 01:02:03') -- !query schema -struct<timestampadd(-1, TIMESTAMP '2022-02-14 01:02:03'):timestamp> +struct<timestampadd(MONTH, -1, TIMESTAMP '2022-02-14 01:02:03'):timestamp> -- !query output 2022-01-14 01:02:03 @@ -1596,7 +1596,7 @@ struct<timestampadd(-1, TIMESTAMP '2022-02-14 01:02:03'):timestamp> -- !query select timestampadd(MINUTE, 58, timestamp'2022-02-14 01:02:03') -- !query schema -struct<timestampadd(58, TIMESTAMP '2022-02-14 01:02:03'):timestamp> +struct<timestampadd(MINUTE, 58, TIMESTAMP '2022-02-14 01:02:03'):timestamp> -- !query output 2022-02-14 02:00:03 @@ -1604,7 +1604,7 @@ struct<timestampadd(58, TIMESTAMP '2022-02-14 01:02:03'):timestamp> -- !query select timestampadd(YEAR, 1, date'2022-02-15') -- !query schema -struct<timestampadd(1, DATE '2022-02-15'):timestamp> +struct<timestampadd(YEAR, 1, DATE '2022-02-15'):timestamp> -- !query output 2023-02-15 00:00:00 @@ -1612,7 +1612,7 @@ struct<timestampadd(1, DATE '2022-02-15'):timestamp> -- !query select timestampadd(SECOND, -1, date'2022-02-15') -- !query schema -struct<timestampadd(-1, DATE '2022-02-15'):timestamp> +struct<timestampadd(SECOND, -1, DATE '2022-02-15'):timestamp> -- !query output 2022-02-14 23:59:59 @@ -1620,7 +1620,7 @@ struct<timestampadd(-1, DATE '2022-02-15'):timestamp> -- !query select timestampdiff(MONTH, timestamp'2022-02-14 01:02:03', timestamp'2022-01-14 01:02:03') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-14 01:02:03', TIMESTAMP '2022-01-14 01:02:03'):bigint> +struct<timestampdiff(MONTH, TIMESTAMP '2022-02-14 01:02:03', TIMESTAMP '2022-01-14 01:02:03'):bigint> -- !query output -1 @@ -1628,7 +1628,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-14 01:02:03', TIMESTAMP '2022-01-14 01:0 -- !query select timestampdiff(MINUTE, timestamp'2022-02-14 01:02:03', timestamp'2022-02-14 02:00:03') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-14 01:02:03', TIMESTAMP '2022-02-14 02:00:03'):bigint> +struct<timestampdiff(MINUTE, TIMESTAMP '2022-02-14 01:02:03', TIMESTAMP '2022-02-14 02:00:03'):bigint> -- !query output 58 @@ -1636,7 +1636,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-14 01:02:03', TIMESTAMP '2022-02-14 02:0 -- !query select timestampdiff(YEAR, date'2022-02-15', date'2023-02-15') -- !query schema -struct<timestampdiff(DATE '2022-02-15', DATE '2023-02-15'):bigint> +struct<timestampdiff(YEAR, DATE '2022-02-15', DATE '2023-02-15'):bigint> -- !query output 1 @@ -1644,6 +1644,6 @@ struct<timestampdiff(DATE '2022-02-15', DATE '2023-02-15'):bigint> -- !query select timestampdiff(SECOND, date'2022-02-15', timestamp'2022-02-14 23:59:59') -- !query schema -struct<timestampdiff(DATE '2022-02-15', TIMESTAMP '2022-02-14 23:59:59'):bigint> +struct<timestampdiff(SECOND, DATE '2022-02-15', TIMESTAMP '2022-02-14 23:59:59'):bigint> -- !query output -1 diff --git a/sql/core/src/test/resources/sql-tests/results/timestamp-ntz.sql.out b/sql/core/src/test/resources/sql-tests/results/timestamp-ntz.sql.out index c4fcff4..f36ffff 100644 --- a/sql/core/src/test/resources/sql-tests/results/timestamp-ntz.sql.out +++ b/sql/core/src/test/resources/sql-tests/results/timestamp-ntz.sql.out @@ -70,7 +70,7 @@ struct<convert_timezone(Europe/Moscow, America/Los_Angeles, TIMESTAMP_NTZ '2022- -- !query select timestampdiff(QUARTER, timestamp_ntz'2022-01-01 01:02:03', timestamp_ntz'2022-05-02 05:06:07') -- !query schema -struct<timestampdiff(TIMESTAMP_NTZ '2022-01-01 01:02:03', TIMESTAMP_NTZ '2022-05-02 05:06:07'):bigint> +struct<timestampdiff(QUARTER, TIMESTAMP_NTZ '2022-01-01 01:02:03', TIMESTAMP_NTZ '2022-05-02 05:06:07'):bigint> -- !query output 1 @@ -78,7 +78,7 @@ struct<timestampdiff(TIMESTAMP_NTZ '2022-01-01 01:02:03', TIMESTAMP_NTZ '2022-05 -- !query select timestampdiff(HOUR, timestamp_ntz'2022-02-14 01:02:03', timestamp_ltz'2022-02-14 02:03:04') -- !query schema -struct<timestampdiff(TIMESTAMP_NTZ '2022-02-14 01:02:03', TIMESTAMP '2022-02-14 02:03:04'):bigint> +struct<timestampdiff(HOUR, TIMESTAMP_NTZ '2022-02-14 01:02:03', TIMESTAMP '2022-02-14 02:03:04'):bigint> -- !query output 1 @@ -86,7 +86,7 @@ struct<timestampdiff(TIMESTAMP_NTZ '2022-02-14 01:02:03', TIMESTAMP '2022-02-14 -- !query select timestampdiff(YEAR, date'2022-02-15', timestamp_ntz'2023-02-15 10:11:12') -- !query schema -struct<timestampdiff(DATE '2022-02-15', TIMESTAMP_NTZ '2023-02-15 10:11:12'):bigint> +struct<timestampdiff(YEAR, DATE '2022-02-15', TIMESTAMP_NTZ '2023-02-15 10:11:12'):bigint> -- !query output 1 @@ -94,6 +94,6 @@ struct<timestampdiff(DATE '2022-02-15', TIMESTAMP_NTZ '2023-02-15 10:11:12'):big -- !query select timestampdiff(MILLISECOND, timestamp_ntz'2022-02-14 23:59:59.123', date'2022-02-15') -- !query schema -struct<timestampdiff(TIMESTAMP_NTZ '2022-02-14 23:59:59.123', DATE '2022-02-15'):bigint> +struct<timestampdiff(MILLISECOND, TIMESTAMP_NTZ '2022-02-14 23:59:59.123', DATE '2022-02-15'):bigint> -- !query output 877 diff --git a/sql/core/src/test/resources/sql-tests/results/timestamp.sql.out b/sql/core/src/test/resources/sql-tests/results/timestamp.sql.out index 792b0a5..9974a26 100644 --- a/sql/core/src/test/resources/sql-tests/results/timestamp.sql.out +++ b/sql/core/src/test/resources/sql-tests/results/timestamp.sql.out @@ -778,7 +778,7 @@ You may get a different result due to the upgrading to Spark >= 3.0: Fail to rec -- !query select timestampadd(MONTH, -1, timestamp'2022-02-14 01:02:03') -- !query schema -struct<timestampadd(-1, TIMESTAMP '2022-02-14 01:02:03'):timestamp> +struct<timestampadd(MONTH, -1, TIMESTAMP '2022-02-14 01:02:03'):timestamp> -- !query output 2022-01-14 01:02:03 @@ -786,7 +786,7 @@ struct<timestampadd(-1, TIMESTAMP '2022-02-14 01:02:03'):timestamp> -- !query select timestampadd(MINUTE, 58, timestamp'2022-02-14 01:02:03') -- !query schema -struct<timestampadd(58, TIMESTAMP '2022-02-14 01:02:03'):timestamp> +struct<timestampadd(MINUTE, 58, TIMESTAMP '2022-02-14 01:02:03'):timestamp> -- !query output 2022-02-14 02:00:03 @@ -794,7 +794,7 @@ struct<timestampadd(58, TIMESTAMP '2022-02-14 01:02:03'):timestamp> -- !query select timestampadd(YEAR, 1, date'2022-02-15') -- !query schema -struct<timestampadd(1, DATE '2022-02-15'):timestamp> +struct<timestampadd(YEAR, 1, DATE '2022-02-15'):timestamp> -- !query output 2023-02-15 00:00:00 @@ -802,7 +802,7 @@ struct<timestampadd(1, DATE '2022-02-15'):timestamp> -- !query select timestampadd(SECOND, -1, date'2022-02-15') -- !query schema -struct<timestampadd(-1, DATE '2022-02-15'):timestamp> +struct<timestampadd(SECOND, -1, DATE '2022-02-15'):timestamp> -- !query output 2022-02-14 23:59:59 @@ -810,7 +810,7 @@ struct<timestampadd(-1, DATE '2022-02-15'):timestamp> -- !query select timestampdiff(MONTH, timestamp'2022-02-14 01:02:03', timestamp'2022-01-14 01:02:03') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-14 01:02:03', TIMESTAMP '2022-01-14 01:02:03'):bigint> +struct<timestampdiff(MONTH, TIMESTAMP '2022-02-14 01:02:03', TIMESTAMP '2022-01-14 01:02:03'):bigint> -- !query output -1 @@ -818,7 +818,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-14 01:02:03', TIMESTAMP '2022-01-14 01:0 -- !query select timestampdiff(MINUTE, timestamp'2022-02-14 01:02:03', timestamp'2022-02-14 02:00:03') -- !query schema -struct<timestampdiff(TIMESTAMP '2022-02-14 01:02:03', TIMESTAMP '2022-02-14 02:00:03'):bigint> +struct<timestampdiff(MINUTE, TIMESTAMP '2022-02-14 01:02:03', TIMESTAMP '2022-02-14 02:00:03'):bigint> -- !query output 58 @@ -826,7 +826,7 @@ struct<timestampdiff(TIMESTAMP '2022-02-14 01:02:03', TIMESTAMP '2022-02-14 02:0 -- !query select timestampdiff(YEAR, date'2022-02-15', date'2023-02-15') -- !query schema -struct<timestampdiff(DATE '2022-02-15', DATE '2023-02-15'):bigint> +struct<timestampdiff(YEAR, DATE '2022-02-15', DATE '2023-02-15'):bigint> -- !query output 1 @@ -834,6 +834,6 @@ struct<timestampdiff(DATE '2022-02-15', DATE '2023-02-15'):bigint> -- !query select timestampdiff(SECOND, date'2022-02-15', timestamp'2022-02-14 23:59:59') -- !query schema -struct<timestampdiff(DATE '2022-02-15', TIMESTAMP '2022-02-14 23:59:59'):bigint> +struct<timestampdiff(SECOND, DATE '2022-02-15', TIMESTAMP '2022-02-14 23:59:59'):bigint> -- !query output -1 diff --git a/sql/core/src/test/resources/sql-tests/results/timestampNTZ/timestamp-ansi.sql.out b/sql/core/src/test/resources/sql-tests/results/timestampNTZ/timestamp-ansi.sql.out index 9cad5a3..3f275b2 100644 --- a/sql/core/src/test/resources/sql-tests/results/timestampNTZ/timestamp-ansi.sql.out +++ b/sql/core/src/test/resources/sql-tests/results/timestampNTZ/timestamp-ansi.sql.out @@ -783,7 +783,7 @@ struct<from_csv(26/October/2015):struct<t:timestamp_ntz>> -- !query select timestampadd(MONTH, -1, timestamp'2022-02-14 01:02:03') -- !query schema -struct<timestampadd(-1, TIMESTAMP_NTZ '2022-02-14 01:02:03'):timestamp_ntz> +struct<timestampadd(MONTH, -1, TIMESTAMP_NTZ '2022-02-14 01:02:03'):timestamp_ntz> -- !query output 2022-01-14 01:02:03 @@ -791,7 +791,7 @@ struct<timestampadd(-1, TIMESTAMP_NTZ '2022-02-14 01:02:03'):timestamp_ntz> -- !query select timestampadd(MINUTE, 58, timestamp'2022-02-14 01:02:03') -- !query schema -struct<timestampadd(58, TIMESTAMP_NTZ '2022-02-14 01:02:03'):timestamp_ntz> +struct<timestampadd(MINUTE, 58, TIMESTAMP_NTZ '2022-02-14 01:02:03'):timestamp_ntz> -- !query output 2022-02-14 02:00:03 @@ -799,7 +799,7 @@ struct<timestampadd(58, TIMESTAMP_NTZ '2022-02-14 01:02:03'):timestamp_ntz> -- !query select timestampadd(YEAR, 1, date'2022-02-15') -- !query schema -struct<timestampadd(1, DATE '2022-02-15'):timestamp> +struct<timestampadd(YEAR, 1, DATE '2022-02-15'):timestamp> -- !query output 2023-02-15 00:00:00 @@ -807,7 +807,7 @@ struct<timestampadd(1, DATE '2022-02-15'):timestamp> -- !query select timestampadd(SECOND, -1, date'2022-02-15') -- !query schema -struct<timestampadd(-1, DATE '2022-02-15'):timestamp> +struct<timestampadd(SECOND, -1, DATE '2022-02-15'):timestamp> -- !query output 2022-02-14 23:59:59 @@ -815,7 +815,7 @@ struct<timestampadd(-1, DATE '2022-02-15'):timestamp> -- !query select timestampdiff(MONTH, timestamp'2022-02-14 01:02:03', timestamp'2022-01-14 01:02:03') -- !query schema -struct<timestampdiff(TIMESTAMP_NTZ '2022-02-14 01:02:03', TIMESTAMP_NTZ '2022-01-14 01:02:03'):bigint> +struct<timestampdiff(MONTH, TIMESTAMP_NTZ '2022-02-14 01:02:03', TIMESTAMP_NTZ '2022-01-14 01:02:03'):bigint> -- !query output -1 @@ -823,7 +823,7 @@ struct<timestampdiff(TIMESTAMP_NTZ '2022-02-14 01:02:03', TIMESTAMP_NTZ '2022-01 -- !query select timestampdiff(MINUTE, timestamp'2022-02-14 01:02:03', timestamp'2022-02-14 02:00:03') -- !query schema -struct<timestampdiff(TIMESTAMP_NTZ '2022-02-14 01:02:03', TIMESTAMP_NTZ '2022-02-14 02:00:03'):bigint> +struct<timestampdiff(MINUTE, TIMESTAMP_NTZ '2022-02-14 01:02:03', TIMESTAMP_NTZ '2022-02-14 02:00:03'):bigint> -- !query output 58 @@ -831,7 +831,7 @@ struct<timestampdiff(TIMESTAMP_NTZ '2022-02-14 01:02:03', TIMESTAMP_NTZ '2022-02 -- !query select timestampdiff(YEAR, date'2022-02-15', date'2023-02-15') -- !query schema -struct<timestampdiff(DATE '2022-02-15', DATE '2023-02-15'):bigint> +struct<timestampdiff(YEAR, DATE '2022-02-15', DATE '2023-02-15'):bigint> -- !query output 1 @@ -839,6 +839,6 @@ struct<timestampdiff(DATE '2022-02-15', DATE '2023-02-15'):bigint> -- !query select timestampdiff(SECOND, date'2022-02-15', timestamp'2022-02-14 23:59:59') -- !query schema -struct<timestampdiff(DATE '2022-02-15', TIMESTAMP_NTZ '2022-02-14 23:59:59'):bigint> +struct<timestampdiff(SECOND, DATE '2022-02-15', TIMESTAMP_NTZ '2022-02-14 23:59:59'):bigint> -- !query output -1 diff --git a/sql/core/src/test/resources/sql-tests/results/timestampNTZ/timestamp.sql.out b/sql/core/src/test/resources/sql-tests/results/timestampNTZ/timestamp.sql.out index 4ae5a8d..85fa0be 100644 --- a/sql/core/src/test/resources/sql-tests/results/timestampNTZ/timestamp.sql.out +++ b/sql/core/src/test/resources/sql-tests/results/timestampNTZ/timestamp.sql.out @@ -776,7 +776,7 @@ struct<from_csv(26/October/2015):struct<t:timestamp_ntz>> -- !query select timestampadd(MONTH, -1, timestamp'2022-02-14 01:02:03') -- !query schema -struct<timestampadd(-1, TIMESTAMP_NTZ '2022-02-14 01:02:03'):timestamp_ntz> +struct<timestampadd(MONTH, -1, TIMESTAMP_NTZ '2022-02-14 01:02:03'):timestamp_ntz> -- !query output 2022-01-14 01:02:03 @@ -784,7 +784,7 @@ struct<timestampadd(-1, TIMESTAMP_NTZ '2022-02-14 01:02:03'):timestamp_ntz> -- !query select timestampadd(MINUTE, 58, timestamp'2022-02-14 01:02:03') -- !query schema -struct<timestampadd(58, TIMESTAMP_NTZ '2022-02-14 01:02:03'):timestamp_ntz> +struct<timestampadd(MINUTE, 58, TIMESTAMP_NTZ '2022-02-14 01:02:03'):timestamp_ntz> -- !query output 2022-02-14 02:00:03 @@ -792,7 +792,7 @@ struct<timestampadd(58, TIMESTAMP_NTZ '2022-02-14 01:02:03'):timestamp_ntz> -- !query select timestampadd(YEAR, 1, date'2022-02-15') -- !query schema -struct<timestampadd(1, DATE '2022-02-15'):timestamp> +struct<timestampadd(YEAR, 1, DATE '2022-02-15'):timestamp> -- !query output 2023-02-15 00:00:00 @@ -800,7 +800,7 @@ struct<timestampadd(1, DATE '2022-02-15'):timestamp> -- !query select timestampadd(SECOND, -1, date'2022-02-15') -- !query schema -struct<timestampadd(-1, DATE '2022-02-15'):timestamp> +struct<timestampadd(SECOND, -1, DATE '2022-02-15'):timestamp> -- !query output 2022-02-14 23:59:59 @@ -808,7 +808,7 @@ struct<timestampadd(-1, DATE '2022-02-15'):timestamp> -- !query select timestampdiff(MONTH, timestamp'2022-02-14 01:02:03', timestamp'2022-01-14 01:02:03') -- !query schema -struct<timestampdiff(TIMESTAMP_NTZ '2022-02-14 01:02:03', TIMESTAMP_NTZ '2022-01-14 01:02:03'):bigint> +struct<timestampdiff(MONTH, TIMESTAMP_NTZ '2022-02-14 01:02:03', TIMESTAMP_NTZ '2022-01-14 01:02:03'):bigint> -- !query output -1 @@ -816,7 +816,7 @@ struct<timestampdiff(TIMESTAMP_NTZ '2022-02-14 01:02:03', TIMESTAMP_NTZ '2022-01 -- !query select timestampdiff(MINUTE, timestamp'2022-02-14 01:02:03', timestamp'2022-02-14 02:00:03') -- !query schema -struct<timestampdiff(TIMESTAMP_NTZ '2022-02-14 01:02:03', TIMESTAMP_NTZ '2022-02-14 02:00:03'):bigint> +struct<timestampdiff(MINUTE, TIMESTAMP_NTZ '2022-02-14 01:02:03', TIMESTAMP_NTZ '2022-02-14 02:00:03'):bigint> -- !query output 58 @@ -824,7 +824,7 @@ struct<timestampdiff(TIMESTAMP_NTZ '2022-02-14 01:02:03', TIMESTAMP_NTZ '2022-02 -- !query select timestampdiff(YEAR, date'2022-02-15', date'2023-02-15') -- !query schema -struct<timestampdiff(DATE '2022-02-15', DATE '2023-02-15'):bigint> +struct<timestampdiff(YEAR, DATE '2022-02-15', DATE '2023-02-15'):bigint> -- !query output 1 @@ -832,6 +832,6 @@ struct<timestampdiff(DATE '2022-02-15', DATE '2023-02-15'):bigint> -- !query select timestampdiff(SECOND, date'2022-02-15', timestamp'2022-02-14 23:59:59') -- !query schema -struct<timestampdiff(DATE '2022-02-15', TIMESTAMP_NTZ '2022-02-14 23:59:59'):bigint> +struct<timestampdiff(SECOND, DATE '2022-02-15', TIMESTAMP_NTZ '2022-02-14 23:59:59'):bigint> -- !query output -1 --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org