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]
Created on
06-24-2016
01:44 PM
- last edited on
04-21-2026
06:51 AM
by
GrazittiAPI
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?
Created 06-24-2016 03:36 PM
Fixed it 🙂
It seems that the Cloudera deployment of the Piggybank.jar does not containt the xpath functionality
(or any xml functionality at all).
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! 🙂
Created 06-24-2016 03:36 PM
Fixed it 🙂
It seems that the Cloudera deployment of the Piggybank.jar does not containt the xpath functionality
(or any xml functionality at all).
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! 🙂