Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

org.apache.pig.piggybank.evaluation.xml.XPath

avatar
New Contributor

I'm creating a PIG query running on Hue. 

The first part of my query does run:

 

REGISTER piggybank.jar
A = LOAD '/durocan/staging/installationconfigs/InstallationConfigExample.xml' using org.apache.pig.piggybank.storage.XMLLoader('Installation') as (x:chararray);

 

The second part fails:

B = FOREACH A GENERATE org.apache.pig.piggybank.evaluation.xml.XPath(x, 'Installation/Durocan/Sensors/Sensor/Name');

dump B;

 

Error:

 Could not resolve org.apache.pig.piggybank.evaluation.xml.XPath

 

How is it possible that org.apache.pig.piggybank.storage.XMLLoader get's  resolved and org.apache.pig.piggybank.evaluation.xml.XPath is not?

1 ACCEPTED SOLUTION

avatar
New Contributor

Fixed it 🙂

 

It seems that the Cloudera deployment of the Piggybank.jar does not containt the xpath functionality
(or any xml functionality at all).

See: http://grepcode.com/project/repository.cloudera.com/content/repositories/releases/org.apache.pig/pi...

 

I downloaded piggybank.jar 0.15.0 from https://mvnrepository.com/artifact/org.apache.pig/piggybank/0.15.0

put it in /home/ubuntu and used it in my script.

 

 

REGISTER /home/ubuntu/piggybank-0.15.0.jar
A = LOAD '/MyPath/Example.xml' using org.apache.pig.piggybank.storage.XMLLoader('RootNode') as (xmlContents:chararray);
B= FOREACH A GENERATE org.apache.pig.piggybank.evaluation.xml.XPath(xmlContents, 'MyXpathQuery');
STORE B INTO 'Output/B' USING PigStorage();

Now everything works fine! 🙂

 

 

View solution in original post

1 REPLY 1

avatar
New Contributor

Fixed it 🙂

 

It seems that the Cloudera deployment of the Piggybank.jar does not containt the xpath functionality
(or any xml functionality at all).

See: http://grepcode.com/project/repository.cloudera.com/content/repositories/releases/org.apache.pig/pi...

 

I downloaded piggybank.jar 0.15.0 from https://mvnrepository.com/artifact/org.apache.pig/piggybank/0.15.0

put it in /home/ubuntu and used it in my script.

 

 

REGISTER /home/ubuntu/piggybank-0.15.0.jar
A = LOAD '/MyPath/Example.xml' using org.apache.pig.piggybank.storage.XMLLoader('RootNode') as (xmlContents:chararray);
B= FOREACH A GENERATE org.apache.pig.piggybank.evaluation.xml.XPath(xmlContents, 'MyXpathQuery');
STORE B INTO 'Output/B' USING PigStorage();

Now everything works fine! 🙂