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

binstorage fails to write biginteger

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.15.0
    • data, impl
    • None
    • Reviewed

    Description

      When trying to store a biginteger using binstorage the following error is issued (The error might manifest elsewhere too):
      java.lang.RuntimeException: Unexpected data type -1 found in stream

      This is caused by a bug in the writeDatum method of the DataReaderWriter.java class. When writeDatum is called with a BigInteger as a argument, the BigInteger is converted to a byte[] and the writeDatum method is recursively called on the byte[]. writeDatum cannon handle byte[] objects but instead expects DataByteArray objects.

      Suggested fix - wrap byte[] to DataByteArray:
      change this line:
      writeDatum(out, ((BigInteger)val).toByteArray());
      to this:
      writeDatum(out, new DataByteArray(((BigInteger)val).toByteArray()));

      Attachments

        1. PIG-4506-1.patch
          2 kB
          Daniel Dai
        2. PIG-4506-2.patch
          5 kB
          Daniel Dai

        Activity

          People

            ssavvides Savvas Savvides
            ssavvides Savvas Savvides
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 5m
                5m
                Remaining:
                Remaining Estimate - 5m
                5m
                Logged:
                Time Spent - Not Specified
                Not Specified