Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-4376

NullPointerException accessing a field of an invalid bag from a nested foreach

VotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.12.0, 0.13.0, 0.14.0
    • 0.15.0
    • parser
    • None
    • Patch Available
    • Reviewed

    Description

      a = load 'x' as (field);
      b = foreach a {
        c = LIMIT invalidName 1;
        generate c.foo;
      }
      

      Results in the following stack trace:
      [main] ERROR org.apache.pig.PigServer - exception during parsing: Error during parsing. null
      Failed to parse: null
      at org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:201)
      at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1735)
      at org.apache.pig.PigServer$Graph.access$000(PigServer.java:1443)
      at org.apache.pig.PigServer.parseAndBuild(PigServer.java:387)
      at org.apache.pig.PigServer.executeBatch(PigServer.java:412)
      at org.apache.pig.PigServer.executeBatch(PigServer.java:398)
      at org.apache.pig.tools.grunt.GruntParser.executeBatch(GruntParser.java:171)
      at org.apache.pig.tools.grunt.GruntParser.processDump(GruntParser.java:741)
      at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:372)
      at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:230)
      at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:205)
      at org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:81)
      at org.apache.pig.Main.run(Main.java:495)
      at org.apache.pig.Main.main(Main.java:170)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
      at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
      Caused by: java.lang.NullPointerException
      at org.apache.pig.newplan.logical.expression.DereferenceExpression.translateAliasToPos(DereferenceExpression.java:210)
      at org.apache.pig.newplan.logical.expression.DereferenceExpression.getFieldSchema(DereferenceExpression.java:149)
      at org.apache.pig.newplan.logical.optimizer.FieldSchemaResetter.execute(SchemaResetter.java:264)
      at org.apache.pig.newplan.logical.expression.AllSameExpressionVisitor.visit(AllSameExpressionVisitor.java:148)
      at org.apache.pig.newplan.logical.expression.DereferenceExpression.accept(DereferenceExpression.java:84)
      at org.apache.pig.newplan.ReverseDependencyOrderWalker.walk(ReverseDependencyOrderWalker.java:70)
      at org.apache.pig.newplan.PlanVisitor.visit(PlanVisitor.java:52)
      at org.apache.pig.newplan.logical.optimizer.SchemaResetter.visitAll(SchemaResetter.java:67)
      at org.apache.pig.newplan.logical.optimizer.SchemaResetter.visit(SchemaResetter.java:122)
      at org.apache.pig.newplan.logical.relational.LOGenerate.accept(LOGenerate.java:245)
      at org.apache.pig.newplan.DependencyOrderWalker.walk(DependencyOrderWalker.java:75)
      at org.apache.pig.newplan.logical.optimizer.SchemaResetter.visit(SchemaResetter.java:114)
      at org.apache.pig.parser.LogicalPlanBuilder.buildForeachOp(LogicalPlanBuilder.java:1055)
      at org.apache.pig.parser.LogicalPlanGenerator.foreach_clause(LogicalPlanGenerator.java:15896)
      at org.apache.pig.parser.LogicalPlanGenerator.op_clause(LogicalPlanGenerator.java:1933)
      at org.apache.pig.parser.LogicalPlanGenerator.general_statement(LogicalPlanGenerator.java:1102)
      at org.apache.pig.parser.LogicalPlanGenerator.statement(LogicalPlanGenerator.java:560)
      at org.apache.pig.parser.LogicalPlanGenerator.query(LogicalPlanGenerator.java:421)
      at org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:191)

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            kspringborn Kevin Springborn
            kspringborn Kevin Springborn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Issue deployment