Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

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! 🙂