hadoophiveqlapache-hive

Apache Hive - Single Insert Date Value


I'm trying to insert a date into a date column using Hive. So far, here's what i've tried

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));

AND

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));

AND

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);

But i still get

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 has been enabled on the ORC based table and simple inserts without dates are working.

I think i'm missing something really simple. But can't put my finger on it.


Solution

  • Ok. I found it. I feel like a doofus now.

    It was as simple as

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