2016-06-23 28 views
1

我正在嘗試使用Hive將日期插入到日期列中。到目前爲止,這裏就是我試過Apache 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的表上啓用,並且沒有日期的簡單插入正在工作。

我想我錯過了一些非常簡單的事情。但不能把我的手指放在它。

回答

2

好的。我找到了。我現在感覺像一個doofus。

它是那樣簡單

INSERT INTO table1 values ('Clerk#0008000', '2016-01-01');