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

ListSerializer should deserialize as ArrayList with size + 1

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Implemented
    • Affects Version/s: 1.3.0, 1.4.0
    • Fix Version/s: 1.3.0, 1.4.0
    • Component/s: Core
    • Labels:
      None

      Description

      The ListSerializer deserializes a list as ArrayList with exactly the required capacity, i.e., number of serialized objects.

      Several operators in the Table API have a MapState<Long, List<X>> to store received elements in a list per timestamp. Hence, retrieving the list and adding one element to the list is a very common operation.

      Since the list which is deserialized has no room left for adding elements, the first insertion into the list will result in growing the ArrayList which is expensive.

      I propose to initialize the ArrayList returned by the ListSerializer with numberOfSerializedElements + 1. This will only marginally increase the size of the list and allow for one insertion without growing the list.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                fhueske Fabian Hueske
                Reporter:
                fhueske Fabian Hueske
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: