- user has WRITE permission on database schema1
- user has ONLY READ permission on database schema2
- user is currently on database schema2, so the result of after running the query:
USE schema2;
- user is trying to run the following query:
CREATE TABLE schema1.table SELECT * FROM schema2.table;
Error while compiling statement: FAILED: SemanticException 0:0 Error creating temporary folder on: hdfs://nameservice1/user/hive/warehouse/schema2. Error encountered near token 'TOK_TMP_FILE' (state=42000,code=40000)This is caused by Hive bug: HIVE-11427 The workaround is to use the “current” database that is writable by the user who runs the command. So using the above same scenario that user is currently on schema2, if user has WRITE access to “default” or another database, say “schema3”, then the workaround would be to simply switch to either “default” or “schema3” database:
USE schema3;and then run the same query again:
CREATE TABLE schema1.table SELECT * FROM schema2.table;This should allow user to by pass the bug. Note: HIVE-11427 is fixed in the following CDH releases: CDH5.6.1, CDH5.7.1
Thanks for the post, it is very helpful.
Thanks for your comment Trevor.