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

TestJsonLoaderStorage fails with IBM JDK 6/7

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.11.1
    • 0.12.0
    • build
    • IBM J9 VM 1.6.0 SR13 FP1; IBM J9 VM 1.7.0 SR4 FP1

    • Patch Available
    • Reviewed
    • Use TestHelper to sort String representations of HashMaps

    Description

      TestJsonStorageLoader fails due to small differences in the way HashMaps are printed out. The HashMap specification (http://docs.oracle.com/javase/1.5.0/docs/api/java/util/HashMap.html) mentions that "This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time.", so PIG testcases should not rely on the order in which the HashMap items are printed out.

      testJsonLoaderStorage1 explicitly does this comparison:

      Testcase: testJsonLoaderStorage1 took 2.25 sec
      FAILED
      expected:<...3":"c","key2":"b","key1":"a"}}
      {"a0":2,"a1":[

      {"a10":6,"a11":"cat"}

      ,

      {"a10":7,"a11":"dog"}

      ,

      {"a10":8,"a11":"pig"}

      ],"a2":

      {"a20":2.3,"a21":"moon"}

      ,"a3":{"key4":"value4","key1":"value1...> but was:<...1":"a","key2":"b","key3":"c"}}
      {"a0":2,"a1":[

      {"a10":6,"a11":"cat"}

      ,

      {"a10":7,"a11":"dog"}

      ,

      {"a10":8,"a11":"pig"}

      ],"a2":

      {"a20":2.3,"a21":"moon"}

      ,"a3":{"key1":"value1","key4":"value4...>
      junit.framework.ComparisonFailure: expected:<...3":"c","key2":"b","key1":"a"}}
      {"a0":2,"a1":[

      {"a10":6,"a11":"cat"}

      ,

      {"a10":7,"a11":"dog"}

      ,

      {"a10":8,"a11":"pig"}

      ],"a2":

      {"a20":2.3,"a21":"moon"}

      ,"a3":{"key4":"value4","key1":"value1...> but was:<...1":"a","key2":"b","key3":"c"}}
      {"a0":2,"a1":[

      {"a10":6,"a11":"cat"}

      ,

      {"a10":7,"a11":"dog"}

      ,

      {"a10":8,"a11":"pig"}

      ],"a2":

      {"a20":2.3,"a21":"moon"}

      ,"a3":{"key1":"value1","key4":"value4...>
      at org.apache.pig.test.TestJsonLoaderStorage.testJsonLoaderStorage1(TestJsonLoaderStorage.java:63)

      Attachments

        1. PIG-TestJsonStorageLoader.patch
          3 kB
          Leonardo Rangel Augusto

        Activity

          People

            lrangel Leonardo Rangel Augusto
            lrangel Leonardo Rangel Augusto
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: