Support Questions

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

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