2

When I try to create a table in hive getting the following error message. Any idea why this is happening?

hive> create table a (x int);

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:For direct MetaStore DB connections, we don't support retries at the client level.)

Following were the logs:

 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate key name 'TBLS_FK2' at sun.reflect.GeneratedConstructorAccessor25.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorA‌​ccessorImpl.java:45) 
Sohil Shivani
  • 336
  • 4
  • 19
Naveenan
  • 345
  • 1
  • 4
  • 16
  • Can you please provide the hive logs?Also which metastore are you using derby or mysql? – Sachin Janani Sep 18 '15 at 08:36
  • thanks for responding. I am using mysql metastore. the log file created under /tmp/username with extension .pipeout is empty. Is there way to enable logging – Naveenan Sep 18 '15 at 20:14
  • Following is snapshot of the log: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate key name 'TBLS_FK2' at sun.reflect.GeneratedConstructorAccessor25.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) – Naveenan Sep 18 '15 at 20:28
  • Can you try stopping the hive server and login to mysql and delete the metastore and start the server again.I think there might be some old metastore which was not properly upgraded in mysql or the metastore tables were not properly created – Sachin Janani Sep 21 '15 at 04:54
  • This link might help you http://qnalist.com/questions/5919571/hive-1-1-0-error-while-metastore-starting – Sachin Janani Sep 21 '15 at 04:56

1 Answers1

1

This might work for you.

Its mandatory to initialize the schema with SCHEMA TOOL

Command: $HIVE_HOME/bin/schematool -dbType mysql -initSchema

Note: In your case -dbType is mysql if you are using mysql as rdbms.

please refer the below link: https://cwiki.apache.org/confluence/display/Hive/Hive+Schema+Tool

Sohil Shivani
  • 336
  • 4
  • 19