Created 12-12-2019 08:56 PM
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)
Created 12-13-2019 12:13 AM
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
Created 01-03-2020 10:03 PM