如何将 BIGINT 求和到 Hive 中的时间戳
How to sum BIGINT into timestamp in Hive
我在配置单元中有两列看起来像这样 table:
Seconds_col Timestamp_col
87 2017-09-25 08:06:00.0
59 2017-09-25 08:10:00.0
我正在尝试创建另一个时间戳列,它是 seconds_col + timestamp_col 的总和,但我在弄清楚如何对类型 seconds_col 求和时遇到问题BIGInt 到 Timestamp_col 中,这是一个时间戳列。有没有人对我如何在蜂巢中完成这个有任何建议?我一直在检查日期和时间函数,但到目前为止我所有的尝试都失败了。任何帮助将不胜感激。
可以实现
设置 1 - 将时间戳隐藏到 unix_timestamp。
步骤 2 - 向 unixtimestamp 添加秒数
step3 - 使用 from_unixtime 转换回时间戳。
select from_unixtime( unix_timestamp(Timestamp_col) + Seconds_col)
from yourtablename
我在配置单元中有两列看起来像这样 table:
Seconds_col Timestamp_col
87 2017-09-25 08:06:00.0
59 2017-09-25 08:10:00.0
我正在尝试创建另一个时间戳列,它是 seconds_col + timestamp_col 的总和,但我在弄清楚如何对类型 seconds_col 求和时遇到问题BIGInt 到 Timestamp_col 中,这是一个时间戳列。有没有人对我如何在蜂巢中完成这个有任何建议?我一直在检查日期和时间函数,但到目前为止我所有的尝试都失败了。任何帮助将不胜感激。
可以实现
设置 1 - 将时间戳隐藏到 unix_timestamp。
步骤 2 - 向 unixtimestamp 添加秒数
step3 - 使用 from_unixtime 转换回时间戳。
select from_unixtime( unix_timestamp(Timestamp_col) + Seconds_col)
from yourtablename