Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

SQOOP export Hive View to Oracle

avatar
New Contributor

While trying to export Hive view to Oracle, columns are getting resolved. However the job fails with Null pointer exception. Does it SQOOP not support export data through view? If I change the view to table, it works as expected.

 

sqoop export -D mapred.job.queue.name=XYZ --connect jdbc:netezza://hostdTL/dbName--table tblName --username userId --password password--hcatalog-table viewName --hcatalog-database dbName

 

Caused by: java.lang.NullPointerException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.apache.hive.hcatalog.mapreduce.FosterStorageHandler.<init>(FosterStorageHandler.java:59)
at org.apache.hive.hcatalog.common.HCatUtil.getStorageHandler(HCatUtil.java:404)
at org.apache.hive.hcatalog.common.HCatUtil.getStorageHandler(HCatUtil.java:367)
at org.apache.hive.hcatalog.mapreduce.InitializeInput.extractPartInfo(InitializeInput.java:158)
at org.apache.hive.hcatalog.mapreduce.InitializeInput.getInputJobInfo(InitializeInput.java:137)
at org.apache.hive.hcatalog.mapreduce.InitializeInput.setInput(InitializeInput.java:86)
at org.apache.hive.hcatalog.mapreduce.HCatInputFormat.setInput(HCatInputFormat.java:95)

2 REPLIES 2

avatar
Master Mentor

@Shaneg 

 

To understand your problem you should know the difference between a view and a table?

Views are definitions built on top of other tables or other views and do not hold data themselves. If data is changing in the underlying table, the same change is reflected in the view. A view can be built on top of a single table or multiple tables.

 

Now to answer your question a table contains data, a view is just a SELECT statement that has been saved in the database or metastore depending on your database.

This explains why the columns are getting resolved because the definition of the view exists but the NULL pointer exception tells you there is no data in that view as it ONLY holds the definition but not the data!

I haven't tried it yet in Oracle but I think it's not possible to import data from a view too, However, a materialized view is a physical copy of the base table could work in the export I am not sure, you could test that.

 

Happy hadooping

 

 

avatar
Super Guru
@Shaneg

For Sqoop export, parameter "--export-dir" is required, please refer to below doc:
https://sqoop.apache.org/docs/1.4.7/SqoopUserGuide.html#_syntax_4

Export is designed to export HDFS data to RDBMS, not Hive tables to RDBMS.

Hope that helps.

Cheers
Eric