Skip to content

Commit 025fdd2

Browse files
committed
address comment
1 parent 46c8651 commit 025fdd2

5 files changed

Lines changed: 33 additions & 33 deletions

File tree

sql/core/src/test/resources/sql-functions/sql-expression-schema.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,9 @@
289289
| org.apache.spark.sql.catalyst.expressions.UnaryMinus | negative | SELECT negative(1) | struct<negative(1):int> |
290290
| org.apache.spark.sql.catalyst.expressions.UnaryPositive | positive | SELECT positive(1) | struct<(+ 1):int> |
291291
| org.apache.spark.sql.catalyst.expressions.Unhex | unhex | SELECT decode(unhex('537061726B2053514C'), 'UTF-8') | struct<decode(unhex(537061726B2053514C), UTF-8):string> |
292-
| org.apache.spark.sql.catalyst.expressions.UnixMicros | unix_micros | SELECT unix_micros(TIMESTAMP('1970-01-01 00:00:01')) | struct<unix_micros(CAST(1970-01-01 00:00:01 AS TIMESTAMP)):bigint> |
293-
| org.apache.spark.sql.catalyst.expressions.UnixMillis | unix_millis | SELECT unix_millis(TIMESTAMP('1970-01-01 00:00:01')) | struct<unix_millis(CAST(1970-01-01 00:00:01 AS TIMESTAMP)):bigint> |
294-
| org.apache.spark.sql.catalyst.expressions.UnixSeconds | unix_seconds | SELECT unix_seconds(TIMESTAMP('1970-01-01 00:00:01')) | struct<unix_seconds(CAST(1970-01-01 00:00:01 AS TIMESTAMP)):bigint> |
292+
| org.apache.spark.sql.catalyst.expressions.UnixMicros | unix_micros | SELECT unix_micros(TIMESTAMP('1970-01-01 00:00:01Z')) | struct<unix_micros(CAST(1970-01-01 00:00:01Z AS TIMESTAMP)):bigint> |
293+
| org.apache.spark.sql.catalyst.expressions.UnixMillis | unix_millis | SELECT unix_millis(TIMESTAMP('1970-01-01 00:00:01Z')) | struct<unix_millis(CAST(1970-01-01 00:00:01Z AS TIMESTAMP)):bigint> |
294+
| org.apache.spark.sql.catalyst.expressions.UnixSeconds | unix_seconds | SELECT unix_seconds(TIMESTAMP('1970-01-01 00:00:01Z')) | struct<unix_seconds(CAST(1970-01-01 00:00:01Z AS TIMESTAMP)):bigint> |
295295
| org.apache.spark.sql.catalyst.expressions.UnixTimestamp | unix_timestamp | SELECT unix_timestamp() | struct<unix_timestamp(current_timestamp(), yyyy-MM-dd HH:mm:ss):bigint> |
296296
| org.apache.spark.sql.catalyst.expressions.Upper | ucase | SELECT ucase('SparkSql') | struct<ucase(SparkSql):string> |
297297
| org.apache.spark.sql.catalyst.expressions.Upper | upper | SELECT upper('SparkSql') | struct<upper(SparkSql):string> |

sql/core/src/test/resources/sql-tests/inputs/datetime.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ select TIMESTAMP_SECONDS(0.1234567);
1515
-- truncation is OK for float/double
1616
select TIMESTAMP_SECONDS(0.1234567d), TIMESTAMP_SECONDS(FLOAT(0.1234567));
1717
-- UNIX_SECONDS, UNIX_MILLISECONDS and UNIX_MICROSECONDS
18-
select UNIX_SECONDS(TIMESTAMP('2020-12-01 14:30:08')), UNIX_SECONDS(TIMESTAMP('2020-12-01 14:30:08.999999')), UNIX_SECONDS(null);
19-
select UNIX_MILLIS(TIMESTAMP('2020-12-01 14:30:08')), UNIX_MILLIS(TIMESTAMP('2020-12-01 14:30:08.999999')), UNIX_MILLIS(null);
20-
select UNIX_MICROS(TIMESTAMP('2020-12-01 14:30:08')), UNIX_MICROS(TIMESTAMP('2020-12-01 14:30:08.999999')), UNIX_MICROS(null);
18+
select UNIX_SECONDS(TIMESTAMP('2020-12-01 14:30:08Z')), UNIX_SECONDS(TIMESTAMP('2020-12-01 14:30:08.999999Z')), UNIX_SECONDS(null);
19+
select UNIX_MILLIS(TIMESTAMP('2020-12-01 14:30:08Z')), UNIX_MILLIS(TIMESTAMP('2020-12-01 14:30:08.999999Z')), UNIX_MILLIS(null);
20+
select UNIX_MICROS(TIMESTAMP('2020-12-01 14:30:08Z')), UNIX_MICROS(TIMESTAMP('2020-12-01 14:30:08.999999Z')), UNIX_MICROS(null);
2121

2222
-- [SPARK-16836] current_date and current_timestamp literals
2323
select current_date = current_date(), current_timestamp = current_timestamp();

sql/core/src/test/resources/sql-tests/results/ansi/datetime.sql.out

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,27 +88,27 @@ struct<timestamp_seconds(0.1234567):timestamp,timestamp_seconds(CAST(0.1234567 A
8888

8989

9090
-- !query
91-
select UNIX_SECONDS(TIMESTAMP('2020-12-01 14:30:08')), UNIX_SECONDS(TIMESTAMP('2020-12-01 14:30:08.999999')), UNIX_SECONDS(null)
91+
select UNIX_SECONDS(TIMESTAMP('2020-12-01 14:30:08Z')), UNIX_SECONDS(TIMESTAMP('2020-12-01 14:30:08.999999Z')), UNIX_SECONDS(null)
9292
-- !query schema
93-
struct<unix_seconds(CAST(2020-12-01 14:30:08 AS TIMESTAMP)):bigint,unix_seconds(CAST(2020-12-01 14:30:08.999999 AS TIMESTAMP)):bigint,unix_seconds(CAST(NULL AS TIMESTAMP)):bigint>
93+
struct<unix_seconds(CAST(2020-12-01 14:30:08Z AS TIMESTAMP)):bigint,unix_seconds(CAST(2020-12-01 14:30:08.999999Z AS TIMESTAMP)):bigint,unix_seconds(CAST(NULL AS TIMESTAMP)):bigint>
9494
-- !query output
95-
1606861808 1606861808 NULL
95+
1606833008 1606833008 NULL
9696

9797

9898
-- !query
99-
select UNIX_MILLIS(TIMESTAMP('2020-12-01 14:30:08')), UNIX_MILLIS(TIMESTAMP('2020-12-01 14:30:08.999999')), UNIX_MILLIS(null)
99+
select UNIX_MILLIS(TIMESTAMP('2020-12-01 14:30:08Z')), UNIX_MILLIS(TIMESTAMP('2020-12-01 14:30:08.999999Z')), UNIX_MILLIS(null)
100100
-- !query schema
101-
struct<unix_millis(CAST(2020-12-01 14:30:08 AS TIMESTAMP)):bigint,unix_millis(CAST(2020-12-01 14:30:08.999999 AS TIMESTAMP)):bigint,unix_millis(CAST(NULL AS TIMESTAMP)):bigint>
101+
struct<unix_millis(CAST(2020-12-01 14:30:08Z AS TIMESTAMP)):bigint,unix_millis(CAST(2020-12-01 14:30:08.999999Z AS TIMESTAMP)):bigint,unix_millis(CAST(NULL AS TIMESTAMP)):bigint>
102102
-- !query output
103-
1606861808000 1606861808999 NULL
103+
1606833008000 1606833008999 NULL
104104

105105

106106
-- !query
107-
select UNIX_MICROS(TIMESTAMP('2020-12-01 14:30:08')), UNIX_MICROS(TIMESTAMP('2020-12-01 14:30:08.999999')), UNIX_MICROS(null)
107+
select UNIX_MICROS(TIMESTAMP('2020-12-01 14:30:08Z')), UNIX_MICROS(TIMESTAMP('2020-12-01 14:30:08.999999Z')), UNIX_MICROS(null)
108108
-- !query schema
109-
struct<unix_micros(CAST(2020-12-01 14:30:08 AS TIMESTAMP)):bigint,unix_micros(CAST(2020-12-01 14:30:08.999999 AS TIMESTAMP)):bigint,unix_micros(CAST(NULL AS TIMESTAMP)):bigint>
109+
struct<unix_micros(CAST(2020-12-01 14:30:08Z AS TIMESTAMP)):bigint,unix_micros(CAST(2020-12-01 14:30:08.999999Z AS TIMESTAMP)):bigint,unix_micros(CAST(NULL AS TIMESTAMP)):bigint>
110110
-- !query output
111-
1606861808000000 1606861808999999 NULL
111+
1606833008000000 1606833008999999 NULL
112112

113113

114114
-- !query

sql/core/src/test/resources/sql-tests/results/datetime-legacy.sql.out

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,27 +88,27 @@ struct<timestamp_seconds(0.1234567):timestamp,timestamp_seconds(CAST(0.1234567 A
8888

8989

9090
-- !query
91-
select UNIX_SECONDS(TIMESTAMP('2020-12-01 14:30:08')), UNIX_SECONDS(TIMESTAMP('2020-12-01 14:30:08.999999')), UNIX_SECONDS(null)
91+
select UNIX_SECONDS(TIMESTAMP('2020-12-01 14:30:08Z')), UNIX_SECONDS(TIMESTAMP('2020-12-01 14:30:08.999999Z')), UNIX_SECONDS(null)
9292
-- !query schema
93-
struct<unix_seconds(CAST(2020-12-01 14:30:08 AS TIMESTAMP)):bigint,unix_seconds(CAST(2020-12-01 14:30:08.999999 AS TIMESTAMP)):bigint,unix_seconds(CAST(NULL AS TIMESTAMP)):bigint>
93+
struct<unix_seconds(CAST(2020-12-01 14:30:08Z AS TIMESTAMP)):bigint,unix_seconds(CAST(2020-12-01 14:30:08.999999Z AS TIMESTAMP)):bigint,unix_seconds(CAST(NULL AS TIMESTAMP)):bigint>
9494
-- !query output
95-
1606861808 1606861808 NULL
95+
1606833008 1606833008 NULL
9696

9797

9898
-- !query
99-
select UNIX_MILLIS(TIMESTAMP('2020-12-01 14:30:08')), UNIX_MILLIS(TIMESTAMP('2020-12-01 14:30:08.999999')), UNIX_MILLIS(null)
99+
select UNIX_MILLIS(TIMESTAMP('2020-12-01 14:30:08Z')), UNIX_MILLIS(TIMESTAMP('2020-12-01 14:30:08.999999Z')), UNIX_MILLIS(null)
100100
-- !query schema
101-
struct<unix_millis(CAST(2020-12-01 14:30:08 AS TIMESTAMP)):bigint,unix_millis(CAST(2020-12-01 14:30:08.999999 AS TIMESTAMP)):bigint,unix_millis(CAST(NULL AS TIMESTAMP)):bigint>
101+
struct<unix_millis(CAST(2020-12-01 14:30:08Z AS TIMESTAMP)):bigint,unix_millis(CAST(2020-12-01 14:30:08.999999Z AS TIMESTAMP)):bigint,unix_millis(CAST(NULL AS TIMESTAMP)):bigint>
102102
-- !query output
103-
1606861808000 1606861808999 NULL
103+
1606833008000 1606833008999 NULL
104104

105105

106106
-- !query
107-
select UNIX_MICROS(TIMESTAMP('2020-12-01 14:30:08')), UNIX_MICROS(TIMESTAMP('2020-12-01 14:30:08.999999')), UNIX_MICROS(null)
107+
select UNIX_MICROS(TIMESTAMP('2020-12-01 14:30:08Z')), UNIX_MICROS(TIMESTAMP('2020-12-01 14:30:08.999999Z')), UNIX_MICROS(null)
108108
-- !query schema
109-
struct<unix_micros(CAST(2020-12-01 14:30:08 AS TIMESTAMP)):bigint,unix_micros(CAST(2020-12-01 14:30:08.999999 AS TIMESTAMP)):bigint,unix_micros(CAST(NULL AS TIMESTAMP)):bigint>
109+
struct<unix_micros(CAST(2020-12-01 14:30:08Z AS TIMESTAMP)):bigint,unix_micros(CAST(2020-12-01 14:30:08.999999Z AS TIMESTAMP)):bigint,unix_micros(CAST(NULL AS TIMESTAMP)):bigint>
110110
-- !query output
111-
1606861808000000 1606861808999999 NULL
111+
1606833008000000 1606833008999999 NULL
112112

113113

114114
-- !query

sql/core/src/test/resources/sql-tests/results/datetime.sql.out

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,27 +88,27 @@ struct<timestamp_seconds(0.1234567):timestamp,timestamp_seconds(CAST(0.1234567 A
8888

8989

9090
-- !query
91-
select UNIX_SECONDS(TIMESTAMP('2020-12-01 14:30:08')), UNIX_SECONDS(TIMESTAMP('2020-12-01 14:30:08.999999')), UNIX_SECONDS(null)
91+
select UNIX_SECONDS(TIMESTAMP('2020-12-01 14:30:08Z')), UNIX_SECONDS(TIMESTAMP('2020-12-01 14:30:08.999999Z')), UNIX_SECONDS(null)
9292
-- !query schema
93-
struct<unix_seconds(CAST(2020-12-01 14:30:08 AS TIMESTAMP)):bigint,unix_seconds(CAST(2020-12-01 14:30:08.999999 AS TIMESTAMP)):bigint,unix_seconds(CAST(NULL AS TIMESTAMP)):bigint>
93+
struct<unix_seconds(CAST(2020-12-01 14:30:08Z AS TIMESTAMP)):bigint,unix_seconds(CAST(2020-12-01 14:30:08.999999Z AS TIMESTAMP)):bigint,unix_seconds(CAST(NULL AS TIMESTAMP)):bigint>
9494
-- !query output
95-
1606861808 1606861808 NULL
95+
1606833008 1606833008 NULL
9696

9797

9898
-- !query
99-
select UNIX_MILLIS(TIMESTAMP('2020-12-01 14:30:08')), UNIX_MILLIS(TIMESTAMP('2020-12-01 14:30:08.999999')), UNIX_MILLIS(null)
99+
select UNIX_MILLIS(TIMESTAMP('2020-12-01 14:30:08Z')), UNIX_MILLIS(TIMESTAMP('2020-12-01 14:30:08.999999Z')), UNIX_MILLIS(null)
100100
-- !query schema
101-
struct<unix_millis(CAST(2020-12-01 14:30:08 AS TIMESTAMP)):bigint,unix_millis(CAST(2020-12-01 14:30:08.999999 AS TIMESTAMP)):bigint,unix_millis(CAST(NULL AS TIMESTAMP)):bigint>
101+
struct<unix_millis(CAST(2020-12-01 14:30:08Z AS TIMESTAMP)):bigint,unix_millis(CAST(2020-12-01 14:30:08.999999Z AS TIMESTAMP)):bigint,unix_millis(CAST(NULL AS TIMESTAMP)):bigint>
102102
-- !query output
103-
1606861808000 1606861808999 NULL
103+
1606833008000 1606833008999 NULL
104104

105105

106106
-- !query
107-
select UNIX_MICROS(TIMESTAMP('2020-12-01 14:30:08')), UNIX_MICROS(TIMESTAMP('2020-12-01 14:30:08.999999')), UNIX_MICROS(null)
107+
select UNIX_MICROS(TIMESTAMP('2020-12-01 14:30:08Z')), UNIX_MICROS(TIMESTAMP('2020-12-01 14:30:08.999999Z')), UNIX_MICROS(null)
108108
-- !query schema
109-
struct<unix_micros(CAST(2020-12-01 14:30:08 AS TIMESTAMP)):bigint,unix_micros(CAST(2020-12-01 14:30:08.999999 AS TIMESTAMP)):bigint,unix_micros(CAST(NULL AS TIMESTAMP)):bigint>
109+
struct<unix_micros(CAST(2020-12-01 14:30:08Z AS TIMESTAMP)):bigint,unix_micros(CAST(2020-12-01 14:30:08.999999Z AS TIMESTAMP)):bigint,unix_micros(CAST(NULL AS TIMESTAMP)):bigint>
110110
-- !query output
111-
1606861808000000 1606861808999999 NULL
111+
1606833008000000 1606833008999999 NULL
112112

113113

114114
-- !query

0 commit comments

Comments
 (0)