Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-16409

Use LinkedHashMap for deterministic iterations

    XMLWordPrintableJSON

Details

    Description

      Test `testKeyedMapStateUpgrade` depends on `put` in `HeapMapState.java` and `deserialize` in `MapSerializer.java`. It has this following test assertion `assertEquals((Integer) 1, actual.getKey());` that asserts the `getKey()` value of `actual`. However the `HashMap` in `put` and `deserialize` does not guarantee any specific order of entries. Therefore, the assertion will fail if the order is different.

       

      This PR proposes to use `LinkedHashMap` for a deterministic order. Please let me know if you want to discuss the changes more.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              testfixer testfixer0
              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