You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Jeff Zhang (JIRA)" <ji...@apache.org> on 2009/06/26 02:40:07 UTC

[jira] Issue Comment Edited: (PIG-851) Map type used as return type in UDFs not recognized at all times

    [ https://issues.apache.org/jira/browse/PIG-851?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12723596#action_12723596 ] 

Jeff Zhang edited comment on PIG-851 at 6/25/09 5:38 PM:
---------------------------------------------------------

Update the patch.
1. Should delete tmp files in MiniCluster mode, invoke this method : FileLocalizer.deleteTempFiles();
2. Change the TestCase to include the Jira number, so it's easy for developers to track the issue


  
> Map type used as return type in UDFs not recognized at all times
> ----------------------------------------------------------------
>
>                 Key: PIG-851
>                 URL: https://issues.apache.org/jira/browse/PIG-851
>             Project: Pig
>          Issue Type: Bug
>          Components: impl
>    Affects Versions: 0.3.0
>            Reporter: Santhosh Srinivasan
>            Assignee: Jeff Zhang
>             Fix For: 0.4.0
>
>         Attachments: Pig_851_patch.txt
>
>
> When an UDF returns a map and the outputSchema method is not overridden, Pig does not figure out the data type. As a result, the type is set to unknown resulting in run time failure. An example script and UDF follow
> {code}
> public class mapUDF extends EvalFunc<Map<Object, Object>> {
>     @Override
>     public Map<Object, Object> exec(Tuple input) throws IOException {
>             return new HashMap<Object, Object>();
>     }
> //Note that the outputSchema method is commented out
> /*
>     @Override
>     public Schema outputSchema(Schema input) {
>         try {
>             return new Schema(new Schema.FieldSchema(null, null, DataType.MAP));
>         } catch (FrontendException e) {
>             return null;
>         }
>     }
> */
> {code}
> {code}
> grunt> a = load 'student_tab.data';           
> grunt> b = foreach a generate EXPLODE(1);
> grunt> describe b;
> b: {Unknown}
> grunt> dump b;
> 2009-06-15 17:59:01,776 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - Failed!
> 2009-06-15 17:59:01,781 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 2080: Foreach currently does not handle type Unknown
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.