Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
create interval-display*.sql
  • Loading branch information
yaooqinn committed Nov 16, 2019
commit 7641e5e154a54307f9055a15ed7064c2a1ed6128
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- tests for interval output style with iso_8601 format
--SET spark.sql.intervalOutputStyle = ISO_8601
--import interval-display.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- tests for interval output style with sql standard format
--SET spark.sql.intervalOutputStyle = SQL_STANDARD
--import interval-display.sql
14 changes: 14 additions & 0 deletions sql/core/src/test/resources/sql-tests/inputs/interval-display.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- tests for interval output style

SELECT
cast(null as interval), -- null
interval '0 day', -- 0
interval '1 year', -- year only
interval '1 month', -- month only
interval '1 year 2 month', -- year month only
interval '1 day -1 hours',
interval '-1 day -1 hours',
interval '-1 day 1 hours',
interval '-1 days +1 hours',
interval '1 years 2 months -3 days 4 hours 5 minutes 6.789 seconds',
- interval '1 years 2 months -3 days 4 hours 5 minutes 6.789 seconds';
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-- Automatically generated by SQLQueryTestSuite
-- Number of queries: 1


-- !query 0
SELECT
cast(null as interval), -- null
interval '0 day', -- 0
interval '1 year', -- year only
interval '1 month', -- month only
interval '1 year 2 month', -- year month only
interval '1 day -1 hours',
interval '-1 day -1 hours',
interval '-1 day 1 hours',
interval '-1 days +1 hours',
interval '1 years 2 months -3 days 4 hours 5 minutes 6.789 seconds',
- interval '1 years 2 months -3 days 4 hours 5 minutes 6.789 seconds'
-- !query 0 schema
struct<CAST(NULL AS INTERVAL):interval,0 seconds:interval,1 years:interval,1 months:interval,1 years 2 months:interval,1 days -1 hours:interval,-1 days -1 hours:interval,-1 days 1 hours:interval,-1 days 1 hours:interval,1 years 2 months -3 days 4 hours 5 minutes 6.789 seconds:interval,-1 years -2 months 3 days -4 hours -5 minutes -6.789 seconds:interval>
-- !query 0 output
NULL PT0S P1Y P1M P1Y2M P1DT-1H P-1DT-1H P-1DT1H P-1DT1H P1Y2M-3DT4H5M6.789S P-1Y-2M3DT-4H-5M-6.789S
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-- Automatically generated by SQLQueryTestSuite
-- Number of queries: 1


-- !query 0
SELECT
cast(null as interval), -- null
interval '0 day', -- 0
interval '1 year', -- year only
interval '1 month', -- month only
interval '1 year 2 month', -- year month only
interval '1 day -1 hours',
interval '-1 day -1 hours',
interval '-1 day 1 hours',
interval '-1 days +1 hours',
interval '1 years 2 months -3 days 4 hours 5 minutes 6.789 seconds',
- interval '1 years 2 months -3 days 4 hours 5 minutes 6.789 seconds'
-- !query 0 schema
struct<CAST(NULL AS INTERVAL):interval,0 seconds:interval,1 years:interval,1 months:interval,1 years 2 months:interval,1 days -1 hours:interval,-1 days -1 hours:interval,-1 days 1 hours:interval,-1 days 1 hours:interval,1 years 2 months -3 days 4 hours 5 minutes 6.789 seconds:interval,-1 years -2 months 3 days -4 hours -5 minutes -6.789 seconds:interval>
-- !query 0 output
NULL 0 +1-0 +0-1 +1-2 +1 -1:00:00 -1 -1:00:00 -1 +1:00:00 -1 +1:00:00 +1-2 -3 +4:05:06.789 -1-2 +3 -4:05:06.789
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-- Automatically generated by SQLQueryTestSuite
-- Number of queries: 1


-- !query 0
SELECT
cast(null as interval), -- null
interval '0 day', -- 0
interval '1 year', -- year only
interval '1 month', -- month only
interval '1 year 2 month', -- year month only
interval '1 day -1 hours',
interval '-1 day -1 hours',
interval '-1 day 1 hours',
interval '-1 days +1 hours',
interval '1 years 2 months -3 days 4 hours 5 minutes 6.789 seconds',
- interval '1 years 2 months -3 days 4 hours 5 minutes 6.789 seconds'
-- !query 0 schema
struct<CAST(NULL AS INTERVAL):interval,0 seconds:interval,1 years:interval,1 months:interval,1 years 2 months:interval,1 days -1 hours:interval,-1 days -1 hours:interval,-1 days 1 hours:interval,-1 days 1 hours:interval,1 years 2 months -3 days 4 hours 5 minutes 6.789 seconds:interval,-1 years -2 months 3 days -4 hours -5 minutes -6.789 seconds:interval>
-- !query 0 output
NULL 0 seconds 1 years 1 months 1 years 2 months 1 days -1 hours -1 days -1 hours -1 days 1 hours -1 days 1 hours 1 years 2 months -3 days 4 hours 5 minutes 6.789 seconds -1 years -2 months 3 days -4 hours -5 minutes -6.789 seconds