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

Russell Jurney commented on PIG-2509:
-------------------------------------

The offending code that is called is here: class 
org.apache.pig.newplan.logical.Util

...

    public static LogicalSchema.LogicalFieldSchema 
translateFieldSchema(Schema.FieldSchema fs) {      
        LogicalSchema newSchema = null;
        if (fs.schema!=null) {
            newSchema = translateSchema(fs.schema);
        }
        
        LogicalSchema.LogicalFieldSchema newFs = new 
LogicalSchema.LogicalFieldSchema(fs.alias, newSchema, fs.type);
        return newFs;
    }
    
    /**
     * This function translates the new LogicalSchema into old Schema format 
required
     * by PhysicalOperators
     * @param schema LogicalSchema to be converted to Schema
     * @return Schema that is converted from LogicalSchema
     * @throws FrontendException 
     */
    public static Schema translateSchema(LogicalSchema schema) {       
        if (schema == null) {
            return null;
        }
        
        Schema s2 = new Schema();
        List<LogicalSchema.LogicalFieldSchema> ll = schema.getFields();
        for (LogicalSchema.LogicalFieldSchema f: ll) {
            Schema.FieldSchema f2 = null;
            try {
                f2 = new Schema.FieldSchema(f.alias, translateSchema(f.schema), 
f.type);
                f2.canonicalName = ((Long)f.uid).toString();
                s2.add(f2);
            } catch (FrontendException e) {
            }
        }
        
        return s2;
    }
                
> Util.getSchemaFromString fails with java.lang.NullPointerException when a 
> tuple in a bag has no name (as when used in MongoStorage UDF)
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: PIG-2509
>                 URL: https://issues.apache.org/jira/browse/PIG-2509
>             Project: Pig
>          Issue Type: Bug
>          Components: piggybank
>    Affects Versions: 0.9.1
>         Environment: No, genetics!
>            Reporter: Russell Jurney
>            Priority: Blocker
>              Labels: fun, happy, mongo, pants, sad, udf, util
>
> The MongoStorage UDF ( https://github.com/mongodb/mongo-hadoop ) fails on its 
> call to Util.getSchemaFromString when a tuple is not named.  The call 
> succeeds when the tuple is explicitly named.  As tuple naming is optional, 
> this is a bug.
> See http://www.mail-archive.com/user%40pig.apache.org/msg04199.html and 
> http://www.mail-archive.com/dev%40pig.apache.org/msg08016.html
> This makes me sad :(

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to