Pig
  1. Pig
  2. PIG-2320

Error: "projection with nothing to reference"

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.0, 0.10.0
    • Fix Version/s: 0.9.2, 0.10.0
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      a = load 'data1' as (x:int);
      b = load 'data2' as (y:int);

      val1 = foreach (filter (cogroup a by x, b by y) by COUNT(b) == 0) generate flatten(a);
      describe val1;

      I found that this script works in 0.8, but messes up in 0.9 and trunk (error is from trunk).

      the error:
      2011-10-14 13:12:48,526 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: Pig script failed to parse:
      <file pig9bug.pig, line 4, column 16> pig script failed to validate: org.apache.pig.impl.logicalLayer.FrontendException: ERROR 2225: Projection with nothing to reference!

      stack trace:
      Pig Stack Trace
      ---------------
      ERROR 1200: Pig script failed to parse:
      <file pig9bug.pig, line 4, column 16> pig script failed to validate: org.apache.pig.impl.logicalLayer.FrontendException: ERROR 2225: Projection with nothing to reference!

      org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. Pig script failed to parse:
      <file pig9bug.pig, line 4, column 16> pig script failed to validate: org.apache.pig.impl.logicalLayer.FrontendException: ERROR 2225: Projection with nothing to reference!
      at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1598)
      at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1541)
      at org.apache.pig.PigServer.registerQuery(PigServer.java:541)
      at org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:943)
      at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:386)
      at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:188)
      at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:164)
      at org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:81)
      at org.apache.pig.Main.run(Main.java:561)
      at org.apache.pig.Main.main(Main.java:111)
      Caused by: Failed to parse: Pig script failed to parse:
      <file pig9bug.pig, line 4, column 16> pig script failed to validate: org.apache.pig.impl.logicalLayer.FrontendException: ERROR 2225: Projection with nothing to reference!
      at org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:178)
      at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1590)
      ... 9 more
      Caused by:
      <file pig9bug.pig, line 4, column 16> pig script failed to validate: org.apache.pig.impl.logicalLayer.FrontendException: ERROR 2225: Projection with nothing to reference!
      at org.apache.pig.parser.LogicalPlanBuilder.buildFilterOp(LogicalPlanBuilder.java:173)
      at org.apache.pig.parser.LogicalPlanGenerator.filter_clause(LogicalPlanGenerator.java:6122)
      at org.apache.pig.parser.LogicalPlanGenerator.op_clause(LogicalPlanGenerator.java:1153)
      at org.apache.pig.parser.LogicalPlanGenerator.inline_op(LogicalPlanGenerator.java:5502)
      at org.apache.pig.parser.LogicalPlanGenerator.rel(LogicalPlanGenerator.java:5432)
      at org.apache.pig.parser.LogicalPlanGenerator.foreach_clause(LogicalPlanGenerator.java:12109)
      at org.apache.pig.parser.LogicalPlanGenerator.op_clause(LogicalPlanGenerator.java:1373)
      at org.apache.pig.parser.LogicalPlanGenerator.general_statement(LogicalPlanGenerator.java:692)
      at org.apache.pig.parser.LogicalPlanGenerator.statement(LogicalPlanGenerator.java:492)
      at org.apache.pig.parser.LogicalPlanGenerator.query(LogicalPlanGenerator.java:378)
      at org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:171)
      ... 10 more
      ================================================================================

        Activity

        Hide
        Jonathan Coveney added a comment -

        I've found a much simpler way to replicate

        load 'data1' as (x:int);
        a_1 = filter (group a by x) by COUNT(a) > 0;
        describe a_1;
        
        Show
        Jonathan Coveney added a comment - I've found a much simpler way to replicate load 'data1' as (x: int ); a_1 = filter (group a by x) by COUNT(a) > 0; describe a_1;
        Hide
        Thejas M Nair added a comment -

        +1
        (the root cause: input relation index is incremented for joins and group-by statement. This index is used while ProjectExpression is constructed. When the group or join is nested in another statement, this index was not being reset as it should have been.)

        Show
        Thejas M Nair added a comment - +1 (the root cause: input relation index is incremented for joins and group-by statement. This index is used while ProjectExpression is constructed. When the group or join is nested in another statement, this index was not being reset as it should have been.)
        Hide
        Daniel Dai added a comment -

        Patch committed to both trunk and 0.9 branch.

        Show
        Daniel Dai added a comment - Patch committed to both trunk and 0.9 branch.

          People

          • Assignee:
            Daniel Dai
            Reporter:
            Jonathan Coveney
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development