Impala: 为时间戳设置一个固定的日期

Impala: set a constant date for timestamp

impala 中是否有替代 to_char() 函数的方法?我想设置一个时间戳字段,其中日期和分钟是固定的并且只显示小时,但似乎找不到替代方案。

这是我在 postgres 中的现有代码,我需要将其转换为 impala。

select to_char(starttime, '1900-01-01 HH24:00:00')::timestamp

感谢任何帮助!

在Impala中,可以使用

SELECT hours_add('1900-01-01', hour(now()));

得到相同的结果

  • 函数hour从时间戳中提取小时部分
  • 函数hours_add 将小时添加到时间戳