Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-23480

Test may fail due to a incorrect usage of a third party library

    XMLWordPrintableJSON

    Details

      Description

      Tests org.apache.hadoop.hive.common.TestStatsSetupConst#testStatColumnEntriesCompat replies on Jackson to serialize the params to string. However, Jackson library uses reflection API getDeclaredFields but it does not guarantee any specific order of returned field so the order of fields in the json string might change, and thus, test can fail or pass without any changes to the code.

      An example error message:

      org.junit.ComparisonFailure: expected:<{"[BASIC_STATS":"true","COLUMN_STATS":{"Foo":"true"}]}> but was:<{"[COLUMN_STATS":{"Foo":"true"},"BASIC_STATS":"true"]}>
      at org.apache.hadoop.hive.common.TestStatsSetupConst.testStatColumnEntriesCompat(TestStatsSetupConst.java:76)
      

      Ideally, this test should not reply on the order returned by this API so that it generates a deterministic result.

      An potential solution is to use library like https://github.com/skyscreamer/JSONassert to compare string in a order-agnostic way.

        Attachments

        1. HIVE-23480.01.patch
          2 kB
          Panagiotis Garefalakis

          Issue Links

            Activity

              People

              • Assignee:
                pgaref Panagiotis Garefalakis
                Reporter:
                contextshuffling contextshuffling
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m