Map type used as return type in UDFs not recognized at all times

                 Key: PIG-851
             Project: Pig
          Issue Type: Bug
          Components: impl
    Affects Versions: 0.3.0
            Reporter: Santhosh Srinivasan
             Fix For: 0.3.0

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

public class mapUDF extends EvalFunc<Map<Object, Object>> {

    public Map<Object, Object> exec(Tuple input) throws IOException {
            return new HashMap<Object, Object>();

//Note that the outputSchema method is commented out

    public Schema outputSchema(Schema input) {
        try {
            return new Schema(new Schema.FieldSchema(null, null, DataType.MAP));
        } catch (FrontendException e) {
            return null;

grunt> a = load '';           
grunt> b = foreach a generate EXPLODE(1);
grunt> describe b;

b: {Unknown}

grunt> dump b;

2009-06-15 17:59:01,776 [main] INFO  
- Failed!

2009-06-15 17:59:01,781 [main] ERROR - ERROR 
2080: Foreach currently does not handle type Unknown


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

Reply via email to