ANSI Intervals¶
Spark SQL supports interval type defined by the ANSI SQL standard using AnsiIntervalType
:
DayTimeIntervalType
for day-time intervalsYearMonthIntervalType
for year-month intervals
Intervals can be positive and negative.
Parquet¶
ANSI intervals are supported by parquet data source as follows:
DayTimeIntervalType
is the same asLongType
(INT64
)YearMonthIntervalType
is the same asIntegerType
(INT32
)
Demo¶
select date'today' - date'2021-01-01' as diff