Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

SQOOP - Hive Import error

SQOOP - Hive Import error

Contributor

I am getting the below error while SQOOP HIVE import. It is working fine for another table. But the same set of instructions are not working for this tables. Even the same code worked fine in the production box. Below I mentioned the error messages.

My SQOOP command:

sqoop import

--connect jdbc:mysql://01-mysql-test232855.envnxs.net:3306/retail_db
--username autoenv_root
-P
--query "select * from agg_dw_orders_lnin_customers where \$CONDITIONS"
--hive-import--hive-table agg_dw_orders_lnin_customers
--hive-database hivesqoop
--target-dir /user/hive/warehouse/orders_warehouse.db/agg_dw_orders_lnin_customers
--split-by order_id
18/11/14 23:32:08 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7
Enter password:
18/11/14 23:32:25 INFO tool.BaseSqoopTool: Using Hive-specific delimiters for output. You can override
18/11/14 23:32:25 INFO tool.BaseSqoopTool: delimiters with --fields-terminated-by, etc.
18/11/14 23:32:25 WARN tool.BaseSqoopTool: It seems that you're doing hive import directly into default
18/11/14 23:32:25 WARN tool.BaseSqoopTool: hive warehouse directory which is not supported. Sqoop is
18/11/14 23:32:25 WARN tool.BaseSqoopTool: firstly importing data into separate directory and then
18/11/14 23:32:25 WARN tool.BaseSqoopTool: inserting data into hive. Please consider removing
18/11/14 23:32:25 WARN tool.BaseSqoopTool: --target-dir or --warehouse-dir into /user/hive/warehouse in
18/11/14 23:32:25 WARN tool.BaseSqoopTool: case that you will detect any issues.
18/11/14 23:32:26 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
18/11/14 23:32:26 INFO tool.CodeGenTool: Beginning code generation
18/11/14 23:32:26 INFO manager.SqlManager: Executing SQL statement: select * from orders where  (1 = 0)
18/11/14 23:32:26 ERROR manager.SqlManager: Error reading from database: java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@564718df is still active. No statements may be issued when any streaming result sets are open and in use on a given connection. Ensure that you have called .close() on any active streaming result sets before attempting more queries.
  java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@564718df is still active. No statements may be issued when any streaming result sets are open and in use on a given connection. Ensure that you have called .close() on any active streaming result sets before attempting more queries.
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:934)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:931)
at com.mysql.jdbc.MysqlIO.checkForOutstandingStreamingData(MysqlIO.java:2747)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1911)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2618)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1557)
at com.mysql.jdbc.ConnectionImpl.getMaxBytesPerChar(ConnectionImpl.java:3002)
at com.mysql.jdbc.Field.getMaxBytesPerCharacter(Field.java:602)
at com.mysql.jdbc.ResultSetMetaData.getPrecision(ResultSetMetaData.java:445)
at org.apache.sqoop.manager.SqlManager.getColumnInfoForRawQuery(SqlManager.java:305)
at org.apache.sqoop.manager.SqlManager.getColumnTypesForRawQuery(SqlManager.java:260)
at org.apache.sqoop.manager.SqlManager.getColumnTypesForQuery(SqlManager.java:253)
at org.apache.sqoop.manager.ConnManager.getColumnTypes(ConnManager.java:336)
at org.apache.sqoop.orm.ClassWriter.getColumnTypes(ClassWriter.java:1872)
at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1671)
at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:106)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:501)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:628)
at org.apache.sqoop.Sqoop.run(Sqoop.java:147)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:234)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:243)
at org.apache.sqoop.Sqoop.main(Sqoop.java:252)
18/11/14 23:32:26 ERROR tool.ImportTool: Import failed: java.io.IOException: No columns to generate for ClassWriter
at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1677)
at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:106)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:501)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:628)
at org.apache.sqoop.Sqoop.run(Sqoop.java:147)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:234)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:243)
at org.apache.sqoop.Sqoop.main(Sqoop.java:252)
1 REPLY 1

Re: SQOOP - Hive Import error

Contributor

I issue got fixed after adding --driver class. New SQOOP import looks like below.

sqoop import
--connect jdbc:mysql://01-mysql-test232855.envnxs.net:3306/retail_db
--username autoenv_root
-P
--query "select * from agg_dw_orders_lnin_customers where \$CONDITIONS"
--hive-import
--hive-table agg_dw_orders_lnin_customers
--hive-database hivesqoop
--target-dir /user/hive/warehouse/orders_warehouse.db/agg_dw_orders_lnin_customers
--split-by order_id
--drive com.mysql.jdbc.Driver
Don't have an account?
Coming from Hortonworks? Activate your account here