3

我正在尝试使用 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

或者

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

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

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

4

1 回答 1

5

行。我找到了。我现在感觉自己像个傻瓜。

这很简单

INSERT INTO table1 values ('Clerk#0008000', '2016-01-01');
于 2016-06-23T11:56:11.550 回答