Sachit Murarka
Sachit Murarka

Reputation: 183

Reading excel file stored in hdfs using java

I am writing a UDF for Hive using Java. I have to read excel files stored in hdfs and do some processing using udf. I am using poi library for processing.

When we read from hdfs we get FSDataInputStream but When we create Workbook using POI it needs InputStream Object.
Though code is not giving error at compile time.

FSDataInputStream stream = hdfs.open(new Path(inputFile));
Workbook workbook= new XSSFWorkbook(stream);

But When I create temporary function I get:

Execution Error, return code -101 from org.apache.hadoop.hive.ql.exec.FunctionTask. org/apache/poi/ss/usermodel/Workbook

Upvotes: 1

Views: 1103

Answers (1)

Luk
Luk

Reputation: 2246

It looks like you didn't add all dependent jars. You need to either build your jar with dependency or add all dependent jars one by one.

Command: hive> add myjar.jar

Upvotes: 1

Related Questions