1. Pig
  2. PIG-2153

POProject throws an error with tuples containing a single non-tuple field


    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 0.8.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:


      When POProject.getNext(tuple) processes a tuple with one field, the field is pulled out. If that field is not a tuple, a cast exception is thrown. This is happening in the folliwing block of code at line 401.

      if(columns.size() == 1) {
      ret = inpValue.get(columns.get(0));
      res.result = (Tuple)ret;

      I am seeing this error in a unit test that is loading an array of floats. The LoadFunc is converting the array to bag, and wrapping the bag in a tuple.



      This results on POProject attempting to cast the bag to a tuple. Looking at the code, it appears that if I wrapped the previous tuple in another tuple, then it would work.



      In this case it would work because POProject would extract the first inner tuple and return it. But this would require the LoadFunc to check for tuples with a single non-tuple field and only wrap those.

      This could be fixed by first checking that the tuple does actually wrap another tuple.

      if(columns.size() == 1 && inpValue.getType(0) == DataType.TUPLE) {...

      I don't know the original intent of this code well enough to say this is the appropriate fix or not. Hoping someone with more Pig experience can help here. Right now this is preventing the unit tests in AvroStorage from working. I can change the unit test, but I think in this case the unit test is catching a real bug.


        Ken Goodhope created issue -
        Ken Goodhope made changes -
        Field Original Value New Value
        Link This issue blocks PIG-1890 [ PIG-1890 ]
        Ken Goodhope made changes -
        Link This issue blocks PIG-1890 [ PIG-1890 ]
        Daniel Dai made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Invalid [ 6 ]


          • Assignee:
            Ken Goodhope
          • Votes:
            0 Vote for this issue
            4 Start watching this issue


            • Created: