[
https://issues.apache.org/jira/browse/SQOOP-1932?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14270744#comment-14270744
]
xieshiju commented on SQOOP-1932:
---------------------------------
Hi jarcec,
I am using Hive 0.13.1
you can using below steps to recreate this problem.
1) create a new user "user123" on linux
2) log on linux with user name "user123"
3) run hive/bin/./hive by user "user123"
4) hive> create database DB1;
5) hive> grant all on database DB1 to user user123;
6) use the new user "user123" to run sqoop command :
./sqoop import --connect 'jdbc:db2://XXXX:50000/SAMPLE' --username XXXX
--password XXXX --as-textfile --hive-import --hive-table DB1.hv_test --table
BOOK --split-by ID --num-mappers 1
Then it will throw errors like : 14/12/19 16:59:55 INFO hive.HiveImport:
Authorization failed:No privilege 'Create' found for outputs {
database:default}. Use show grant to get more details.
The root cause is that sqoop will generate a create statment like below and it
will create a table in the hive default database by default, but current user
"user123" only have privilege on database DB1. If you want to create a table in
a specific database, you should firstly use this database. So I add a command
in the statement " use DB1; "
14/12/19 16:59:49 DEBUG hive.TableDefWriter: Create statement: CREATE TABLE IF
NOT EXISTS `DB1.hv_test` ( `ID` INT, `PRICE` INT, `PAGE` INT, `VERSION` INT)
COMMENT 'Imported by sqoop on 2014/12/19 16:59:49' ROW FORMAT DELIMITED FIELDS
TERMINATED BY '\001' LINES TERMINATED BY '\012' STORED AS TEXTFILE
> fix authorization failuare when the --hive-table option contaion a database
> name for import
> -------------------------------------------------------------------------------------------
>
> Key: SQOOP-1932
> URL: https://issues.apache.org/jira/browse/SQOOP-1932
> Project: Sqoop
> Issue Type: Bug
> Components: hive-integration
> Affects Versions: 1.4.5
> Environment: RedHat6.4 + Sqoop1.4.5 + Hive0.13 + DB2 10.5
> Reporter: xieshiju
> Assignee: xieshiju
> Fix For: 1.4.6
>
> Attachments: SQOOP-1932.patch
>
> Original Estimate: 168h
> Remaining Estimate: 168h
>
> I create a new user user123 and a hive database DB1 in the hive using this
> user user, then execute command grant all on database DB1 to user user123.
> Following I ran a sqoop import command and want to import data from db2 table
> to hive table:
> ./sqoop import --connect 'jdbc:db2://XXXX:50000/XIEDB' --username XXXX
> --password XXXX --as-textfile --hive-import --hive-table DB1.hv_test --table
> DB3BOOK --split-by ID --num-mappers 1
> I got below error:
> 14/12/19 23:00:09 INFO hive.HiveImport: Authorization failed:No privilege
> 'Create' found for outputs { database:default}. Use show grant to get more
> details.
> 14/12/19 23:00:09 ERROR tool.ImportTool: Encountered IOException running
> import job: java.io.IOException: Hive exited with status 147
> at
> org.apache.sqoop.hive.HiveImport.executeExternalHiveScript(HiveImport.java:392)
> at org.apache.sqoop.hive.HiveImport.executeScript(HiveImport.java:341)
> at org.apache.sqoop.hive.HiveImport.importTable(HiveImport.java:245)
> at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:511)
> at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:601)
> at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
> at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
> at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)
> at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)
> at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
> at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)