Hive error when creating an external table (state=08S01,code=1)
The issue was that I was pointing the external table at a file in HDFS instead of a directory. The cryptic Hive error message really threw me off.
The solution is to create a directory and put the data file in there. To fix this for the above example, you'd create a directory under /tmp/foobar
and place hive_test_1375711405.45852.txt
in it. Then create the table like so:
create external table foobar (a STRING, b STRING) row format delimited fields terminated by "\t" stored as textfile location "/tmp/foobar";
We faced similar problem in our company (Sentry, hive, and kerberos combination). We solved it by removing all privileges from non fully defined hdfs_url
. For example, we changed GRANT ALL ON URI '/user/test' TO ROLE test;
to GRANT ALL ON URI 'hdfs-ha-name:///user/test' TO ROLE test;
.
You can find the privileges for a specific URI in the Hive database (mysql in our case).