将时间戳插入Hive

Fro*_*man 5 hadoop hive apache-hive

嗨,我是Hive的新手,我想将当前时间戳和一行数据一起插入到我的表中.

这是我的团队表的一个例子:

team_id int
fname   string
lname   string
time    timestamp
Run Code Online (Sandbox Code Playgroud)

我看了一些其他的例子,如何将时间戳插入Hive表?,我如何在配置单元中添加时间戳列,似乎无法使其工作.这就是我想要的:

insert into team values('101','jim','joe',from_unixtime(unix_timestamp()));
Run Code Online (Sandbox Code Playgroud)

我得到的错误是:

FAILED: SemanticException [Error 10293]: Unable to create temp file for insert values Expression of type TOK_FUNCTION not supported in insert/values
Run Code Online (Sandbox Code Playgroud)

如果有人能提供帮助,那就太棒了,非常感谢霜冻

sya*_*dav 9

可以通过实现current_timestamp(),但只能通过select子句实现.甚至不要求from选择陈述中的条款.

insert into team select '101','jim','joe',current_timestamp();
Run Code Online (Sandbox Code Playgroud)

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

insert into team select '101','jim','joe',current_timestamp() from team limit 1;
Run Code Online (Sandbox Code Playgroud)

  • 我尝试了上面的方法并得到以下错误:`ParseException line 1:65 Failed to identify predicate '<EOF>'。失败的规则:语句中的“regularBody” (2认同)