Pig
  1. Pig
  2. PIG-2411

AvroStorage UDF in PiggyBank fails to STORE a bag of single-field tuples as Avro arrays

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.0, 0.9.1, 0.9.2
    • Fix Version/s: 0.10.0
    • Component/s: piggybank
    • Labels:
    • Environment:

      Mac OS X 10.6.8 in local mode

    • Patch Info:
      Patch Available
    • Hadoop Flags:
      Reviewed
    • Tags:
      avro udf piggybank pig storage

      Description

      This patch is a fix for a bug for persisting bags of tuples via AvroStorage.

      The script that alerted me to a bug is:

      messages = LOAD '/tmp/messages.avro' USING AvroStorage();
      user_groups = GROUP messages by user_id;
      per_user = FOREACH user_groups

      { sorted = ORDER messages BY message_id DESC; GENERATE group AS user_id, sorted AS messages; }

      DESCRIBE per_user
      > per_user: {user_id: int,messages: {(message_id: int,topic: chararray,user_id: int)}}
      STORE per_user INTO '/tmp/per_user.avro' USING AvroStorage();

      The error is:

      Pig Stack Trace
      ---------------
      ERROR 1002: Unable to store alias per_user

      org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1002: Unable to store alias per_user
      at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1596)
      at org.apache.pig.PigServer.registerQuery(PigServer.java:584)
      at org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:942)
      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.run(Grunt.java:67)
      at org.apache.pig.Main.run(Main.java:487)
      at org.apache.pig.Main.main(Main.java:108)
      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.main(RunJar.java:156)
      Caused by: java.lang.NullPointerException
      at org.apache.pig.piggybank.storage.avro.AvroStorageUtils.isTupleWrapper(AvroStorageUtils.java:327)
      at org.apache.pig.piggybank.storage.avro.PigSchema2Avro.convert(PigSchema2Avro.java:82)
      at org.apache.pig.piggybank.storage.avro.PigSchema2Avro.convert(PigSchema2Avro.java:105)
      at org.apache.pig.piggybank.storage.avro.PigSchema2Avro.convertRecord(PigSchema2Avro.java:151)
      at org.apache.pig.piggybank.storage.avro.PigSchema2Avro.convert(PigSchema2Avro.java:62)
      at org.apache.pig.piggybank.storage.avro.AvroStorage.checkSchema(AvroStorage.java:502)
      at org.apache.pig.newplan.logical.rules.InputOutputFileValidator$InputOutputFileVisitor.visit(InputOutputFileValidator.java:65)
      at org.apache.pig.newplan.logical.relational.LOStore.accept(LOStore.java:77)
      at org.apache.pig.newplan.DepthFirstWalker.depthFirst(DepthFirstWalker.java:64)
      at org.apache.pig.newplan.DepthFirstWalker.depthFirst(DepthFirstWalker.java:66)
      at org.apache.pig.newplan.DepthFirstWalker.depthFirst(DepthFirstWalker.java:66)
      at org.apache.pig.newplan.DepthFirstWalker.depthFirst(DepthFirstWalker.java:66)
      at org.apache.pig.newplan.DepthFirstWalker.depthFirst(DepthFirstWalker.java:66)
      at org.apache.pig.newplan.DepthFirstWalker.walk(DepthFirstWalker.java:53)
      at org.apache.pig.newplan.PlanVisitor.visit(PlanVisitor.java:50)
      at org.apache.pig.newplan.logical.rules.InputOutputFileValidator.validate(InputOutputFileValidator.java:45)
      at org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.compile(HExecutionEngine.java:292)
      at org.apache.pig.PigServer.compilePp(PigServer.java:1360)
      at org.apache.pig.PigServer.executeCompiledLogicalPlan(PigServer.java:1297)
      at org.apache.pig.PigServer.execute(PigServer.java:1286)
      at org.apache.pig.PigServer.access$400(PigServer.java:125)
      at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1591)
      ... 13 more

      1. PIG-2411-1.patch
        3 kB
        Daniel Dai
      2. messages.avro
        0.3 kB
        Daniel Dai
      3. avrobug.patch
        1 kB
        Russell Jurney

        Activity

        Hide
        Russell Jurney added a comment -

        Patch attached.

        Show
        Russell Jurney added a comment - Patch attached.
        Show
        Russell Jurney added a comment - See also https://issues.apache.org/jira/browse/PIG-1748
        Hide
        Daniel Dai added a comment -

        Hi, Russell,
        Do you still want to get it into 0.9.2? If so, can you add a test to your patch? Or if you think existing tests already cover it, can you describe it?

        Thanks

        Show
        Daniel Dai added a comment - Hi, Russell, Do you still want to get it into 0.9.2? If so, can you add a test to your patch? Or if you think existing tests already cover it, can you describe it? Thanks
        Hide
        Daniel Dai added a comment -

        Unlink to 0.9.2 since it's too late to get in. Change fix version to 0.10

        Show
        Daniel Dai added a comment - Unlink to 0.9.2 since it's too late to get in. Change fix version to 0.10
        Hide
        Russell Jurney added a comment -

        This now works in my branch of Pig on github, and includes unit tests, input data and expected data in Avro. See: https://github.com/rjurney/pig/tree/branch-0.9

        Committer: please get with me about sorting out this mess.

        Show
        Russell Jurney added a comment - This now works in my branch of Pig on github, and includes unit tests, input data and expected data in Avro. See: https://github.com/rjurney/pig/tree/branch-0.9 Committer: please get with me about sorting out this mess.
        Show
        Russell Jurney added a comment - Started over. The fix is here: https://github.com/rjurney/pig/commit/47811554beeabed433a3cb7942418ab1d354cb3b The test is here: https://github.com/rjurney/pig/commit/6308b04171af4de5d66aa359ee12227674f09e34
        Show
        Russell Jurney added a comment - https://github.com/apache/pig/pull/2
        Hide
        Daniel Dai added a comment -

        Attach the patch from Russell's github.

        Show
        Daniel Dai added a comment - Attach the patch from Russell's github.
        Hide
        Daniel Dai added a comment -

        Patch committed to 0.10/trunk. Thanks Russell!

        Show
        Daniel Dai added a comment - Patch committed to 0.10/trunk. Thanks Russell!

          People

          • Assignee:
            Russell Jurney
            Reporter:
            Russell Jurney
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 6h
              6h
              Remaining:
              Remaining Estimate - 6h
              6h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development