0
votes
create table Book_inf2(OID int, date timestamp, CUSTOMER_ID string, AMOUNT 
int) row format delimited fields terminated by ',';

Error which I got:

FAILED: ParseException line 1:32 missing Identifier at 'date' near 'date' in create table statement line 1:37 mismatched input 'timestamp' expecting ) near 'date' in create table statement

Note: I am new to the Hive, please help me to get understand.

1

1 Answers

0
votes

Date is a reserved keyword in hive that's the reason why you are facing issue

However hive allows to use reserved keywords as field names, but that's not the best practice to use them.

To fix the issue:

Surround date field name with backtick's

`

Try with below create table statement

hive> create table Book_inf2(OID int, `date` timestamp, CUSTOMER_ID string, AMOUNT int) row format delimited fields terminated by ',';