[ 
https://issues.apache.org/jira/browse/DATAFU-40?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Matthew Hayes closed DATAFU-40.
-------------------------------
    Resolution: Won't Fix

Closing this as it is quite old and there have been no updates and there is a 
workaround.

> Using BagGroup may yield error: Problem while reconciling output schema of 
> ForEach
> ----------------------------------------------------------------------------------
>
>                 Key: DATAFU-40
>                 URL: https://issues.apache.org/jira/browse/DATAFU-40
>             Project: DataFu
>          Issue Type: Bug
>            Reporter: Matthew Hayes
>            Priority: Major
>
> This test fails:
> {code}
> /**
>   define BagSum datafu.pig.bags.BagSum();
>   define BagGroup datafu.pig.bags.BagGroup();
>   
>   data = LOAD 'input' USING PigStorage(',') AS (id:int, key:chararray, 
> val:int);
>   describe data;
>   
>   data2 = GROUP data BY id;
>   data3 = FOREACH data2 GENERATE group as id, BagGroup(data,data.key) as 
> grouped;
>   
>   describe data3;
>   
>   data4 = FOREACH data3 {
>     summed = FOREACH grouped GENERATE group as key, SUM(data.val) as total;
>     ordered = ORDER summed BY key;
>     GENERATE id, ordered;
>   }
>   
>   describe data4;
>   
>   STORE data4 INTO 'output';
>    */
>   @Multiline
>   private String bagSumTest;
>   
>   @Test
>   public void bagSumTest() throws Exception
>   {
>     PigTest test = createPigTestFromString(bagSumTest);
>     writeLinesToFile("input", "1,A,1","1,B,2","2,A,3","3,A,4","1,C,5","1,C,6",
>                      "3,A,7","2,B,8","1,A,9","2,A,10");
>     test.runScript();
>     assertOutput(test, "data4", 
>                  "(1,{(A,10),(B,2),(C,11)})",
>                  "(2,{(A,13),(B,8)})",
>                  "(3,{(A,11)})");
>   }
> {code}
> The failure message is:
> {code}
> Caused by: org.apache.pig.impl.logicalLayer.validators.TypeCheckerException: 
> ERROR 1059: 
> <line 6, column 8> Problem while reconciling output schema of ForEach
> {code}
> However, if {{data}} is replaced with {{$1}} the test passes.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to