Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Pig >> mail # dev >> Need help to resolve one error


Copy link to this message
-
Re: Need help to resolve one error
Can you try setup PIG_CLASSPATH before running Pig?
export PIG_CLASSPATH=/home/hdmaster/Downloads/piggybank.jar

Thanks,
Daniel
On Wed, Nov 20, 2013 at 10:50 PM, Haider <[EMAIL PROTECTED]> wrote:

> Hi I am new to PIG scripting.
>
> I am trying to parse XML values through a pig script but getting the error.
>
> ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1070: Could not resolve
> org.apache.pig.piggybank.storage.XMLLoader using imports: [,
> org.apache.pig.builtin., org.apache.pig.impl.builtin.]
>
> my XML file is this
>
> <CATALOG>
> <CD>
> <TITLE>hadoop developer</TITLE>
> <ARTIST>Haider</ARTIST>
> <COUNTRY>india</COUNTRY>
> <COMPANY>Deloitte</COMPANY>
> <PRICE>10.90</PRICE>
> <YEAR>2013</YEAR>
> </CD>
> </CATALOG>
>
> and my pig script is
>
> REGISTER '/home/hdmaster/Downloads/piggybank.jar';
> A = LOAD '/home/hdmaster/Downloads/sample.xml' USING
> org.apache.pig.piggybank.storage.XMLLoader('CD')
>     AS (x:chararray);
>
> B = foreach A GENERATE FLATTEN(REGEX_EXTRACT_ALL(x,
>
>
> '<CD>\\n\\s*<TITLE>(.*)</TITLE>\\n\\s*<ARTIST>(.*)</ARTIST>\\n\\s*<COUNTRY>(.*)</COUNTRY>\\n\\s*<COMPANY>(.*)</COMPANY>\\n\\s*<PRICE>(.*)</PRICE>\\n\\s*<YEAR>(.*)</YEAR>\\n\\s*</CD>'))
>
>     AS (title:chararray, artist:chararray, country:chararray,
> company:chararray, price:double, year:int);
>
> store B into '/home/hdmaster/Downloads/results'
>
>
> Any help on this highly helpful to me.
>
> Thanks
> Haider
>

--
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to
which it is addressed and may contain information that is confidential,
privileged and exempt from disclosure under applicable law. If the reader
of this message is not the intended recipient, you are hereby notified that
any printing, copying, dissemination, distribution, disclosure or
forwarding of this communication is strictly prohibited. If you have
received this communication in error, please contact the sender immediately
and delete it from your system. Thank You.