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