hadoop - 将时间戳插入 Hive

标签 hadoop hive apache-hive

大家好,我是 Hive 新手,我想将当前时间戳与一行数据一起插入到我的表中。

这是我的团队表的示例:

team_id int
fname   string
lname   string
time    timestamp

我看过其他一些例子,How to insert timestamp into a Hive table? , How can I add a timestamp column in hive似乎无法让它发挥作用。 这就是我正在尝试的:

insert into team values('101','jim','joe',from_unixtime(unix_timestamp()));

我得到的错误是:

FAILED: SemanticException [Error 10293]: Unable to create temp file for insert values Expression of type TOK_FUNCTION not supported in insert/values

如果有人能帮忙,那就太好了,非常感谢 frostie

最佳答案

可以通过 current_timestamp() 实现,但只能通过 select 子句。甚至不需要在 select 语句中使用 from 子句。

insert into team select '101','jim','joe',current_timestamp();

或者如果您的配置单元版本不支持在选择语句中保留 from

insert into team select '101','jim','joe',current_timestamp() from team limit 1;

关于hadoop - 将时间戳插入 Hive,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37863194/

相关文章:

hadoop - hbase 0.98.8应该使用哪个版本的Pig

sql - Hadoop 层次结构之谜

hadoop - 在 hive 中加入一张 table 两次

hadoop - Hive命令给出错误

hadoop - 使用sqoop导入数据到hbase

docker - Hadoop在不使用IP的情况下无法访问数据节点

hadoop - 通过 Pig 转储中间 MR 作业数据

amazon-web-services - 亚马逊雅典娜的分区表

mysql - 如何漂亮地打印 Hive 输出

hadoop - Apache hive MSCK REPAIR TABLE 未添加新分区