我有这样的xml文件:
<CATALOG>
<CD>
<TITLE>hadoop developer</TITLE>
<ARTIST>ajay</ARTIST>
<COUNTRY>india</COUNTRY>
<COMPANY>ITC</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>2013</YEAR>
</CD>
</CATALOG>
我使用了一些正则表达式,但我不知道为什么没有得到想要的输出......我的代码如下:
**register /usr/lib/pig/piggybank.jar
A = load 'input.xml' using org.apache.pig.piggybank.storage.XMLLoader('CATALOG') as (x: chararray);
B = foreach A GENERATE FLATTEN(REGEX_EXTRACT_ALL(x,'<CATALOG>\n*<CD>\n<TITLE>(.*)</TITLE>\n*<ARTIST>(.*)</ARTIST>\n*<COUNTRY>(.*)</COUNTRY>\n*<COMPANY>(.*)</COMPANY>\n*<PRICE>(.*)</PRICE>\n*<YEAR>(.*)</YEAR>\n*</CD>\\n*</CATALOG>')) as (name:chararray, words:chararray);**
我的输出如下:
2013-08-20 12:40:24,043 [main] INFO
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - Success!
2013-08-20 12:40:24,044 [main] WARN
org.apache.pig.data.SchemaTupleBackend - SchemaTupleBackend has already been initialized
2013-08-20 12:40:24,047 [main] INFO
org.apache.hadoop.mapreduce.lib.input.FileInputFormat - Total input paths to process : 1
2013-08-20 12:40:24,047 [main] INFO
org.apache.pig.backend.hadoop.executionengine.util.MapRedUtil - Total input paths to process : 1
它有什么问题?谢谢你。