如何检查两个日期时间字段之间的一小时时差?

How to check one hour time difference between two datetime fields?

我有一个 Hive 查询,我想检查 next_datetimecurr_datetime 之间的差异是否不超过一小时。

如果我添加这个 AND 子句,它会检查两个日期时间是否在同一小时。

<...> and hour(next_datetime) = hour(curr_datetime)

是否有以分钟为单位的时差表达式?重要的是 next_datetimecurr_datetime 可能属于不同的日期。

尝试使用 unix_timestamp,检查时差是否小于 3600 秒。

<...> and (unix_timestamp(next_datetime) - unix_timestamp(curr_datetime) <= 3600)