[ https://issues.apache.org/jira/browse/PIG-4938?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15358882#comment-15358882 ]
ASF GitHub Bot commented on PIG-4938: ------------------------------------- GitHub user nandorKollar opened a pull request: https://github.com/apache/pig/pull/26 Fix for piggybank XPath function related bugs: PIG-4938 and PIG-4938 You can merge this pull request into a Git repository by running: $ git pull https://github.com/nandorKollar/pig trunk Alternatively you can review and apply these changes as the patch at: https://github.com/apache/pig/pull/26.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #26 ---- commit ff613c0a9ebf3d7d211aa02bfe79e1d340ecb906 Author: Nandor Kollar <nkol...@cloudera.com> Date: 2016-06-30T11:35:39Z PIG-4751 : XPath/XPathAll - ignoreNamspace breaks searching for XML attributes PIG-4938 : [PiggyBank] XPath returns empty values when using aggregation method commit 06dcc49e3e12e40c5dc2bb196546570dd16cec72 Author: Nandor Kollar <nkol...@cloudera.com> Date: 2016-06-30T11:47:22Z add change history ---- > [PiggyBank] XPath returns empty values when using aggregation method > -------------------------------------------------------------------- > > Key: PIG-4938 > URL: https://issues.apache.org/jira/browse/PIG-4938 > Project: Pig > Issue Type: Bug > Components: piggybank > Affects Versions: 0.15.0 > Reporter: Ivo Lenting > Priority: Minor > > I have a xml file which I want to parse using the piggybank XPath udf. > The xml is: > <Aa name="test1"> > <Bb Cc="1"/> > <Bb Cc="1"/> > <Bb Cc="1"/> > <Bb Cc="1"/> > <Dd>test2</Dd> > </Aa> > The xpath contains a sum aggregate to sum all Cc values. > The complete pig script: > REGISTER piggybank.jar > DEFINE XPath org.apache.pig.piggybank.evaluation.xml.XPath(); > DEFINE XPathAll org.apache.pig.piggybank.evaluation.xml.XPathAll(); > XMLFile = LOAD '/demo/test.xml' using > org.apache.pig.piggybank.storage.XMLLoader('Aa') as (xmlContents:chararray); > MyOutput = FOREACH XMLFile GENERATE > XPathAll(xmlContents,'Aa/@name',true,false).$0 AS > Aa:chararray,XPath(xmlContents,'sum(Aa/Bb/@Cc)') AS Cc:Double, > XPath(xmlContents,'Aa/Dd') AS Dd:chararray; > STORE MyOutput INTO 'Output/MyOutput' USING PigStorage('|'); > MyOutput: > test1||test2 > So i'm missing the aggregate 4 in column 2. -- This message was sent by Atlassian JIRA (v6.3.4#6332)