不能在长类型列上使用间隔



我有一个以下数据类型的spark表

root
|-- id: long (nullable = true)
|-- visit_time: long (nullable = true)
|-- hit_time: long (nullable = true)
+---+----------+--------+
| id|visit_time|hit_time|
+---+----------+--------+
|  1|1664994234|   15612|
|  2|1664945623|28098141|
+---+----------+--------+

我试图添加一个间隔到我的visit_time列与下面的sql

select id,visit_time,
cast(visit_time as TIMESTAMP),
cast(visit_time as TIMESTAMP) + INTERVAL CAST(round((hit_time/1000),0) AS int) second as hit_cst,
hit_time,
CAST(round((hit_time/1000),0) AS int) as dt 
from tbl

sql在计算hit_cst时在第3行失败。如果我试着单独运行它们,每个部分都可以正常工作。

有人能帮帮我吗?

try, cast(visit_time as TIMESTAMP) + make_interval(0,0,0,0,0,0,hit_time/1000) as hit_cst

相关内容

  • 没有找到相关文章

最新更新