Apache Hive - 单个插入日期值

时间:2016-06-23 11:36:32

标签: hadoop hiveql apache-hive

我尝试使用Hive将日期插入日期列。到目前为止,这是我尝试过的内容

INSERT INTO table1 (EmpNo, DOB)
VALUES ('Clerk#0008000', cast(substring(from_unixtime(unix_timestamp(cast('2016-01-01' as string), 'yyyy-MM-dd')),1,10) as date));

INSERT INTO table table1 values('Clerk#0008000', cast(substring(from_unixtime(unix_timestamp(cast('2016-01-01' as string), 'yyyy-MM-dd')),1,10) as date));

INSERT INTO table1 SELECT 
'Clerk#0008000', cast(substring(from_unixtime(unix_timestamp(cast('2016-01-01' as string), 'yyyy-MM-dd')),1,10) as date);

但我还是得到了

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

OR

FAILED: ParseException line 2:186 Failed to recognize predicate '<EOF>'. Failed rule: 'regularBody' in statement

Hive ACID已在基于ORC的表上启用,并且没有日期的简单插入正在运行。

我想我错过了一些非常简单的事情。但不能把手指放在上面。

1 个答案:

答案 0 :(得分:2)

确定。我找到了。我现在感觉像是一个doofus。

就像

一样简单
INSERT INTO table1 values ('Clerk#0008000', '2016-01-01');