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

Use Queue Instead of List for CollectOperator

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 4.0.0-alpha-1
    • None
    • None

    Description

      https://github.com/apache/hive/blob/d6948a28ab3e34e5116591a60a96bdf031185e47/ql/src/java/org/apache/hadoop/hive/ql/exec/CollectOperator.java#L85-L88

      CollectOperator.java
         rowList = new ArrayList<Object>();
      ...
          } else {
            result.o = rowList.remove(0);
            result.oi = standardRowInspector;
          }
      

      Removing from the head of an ArrayList is an expensive operation because it needs to shift all of the elements down in the array for each call. Better to use a Queue

      Attachments

        1. HIVE-23194.1.patch
          1 kB
          David Mollitor

        Activity

          People

            belugabehr David Mollitor
            belugabehr David Mollitor
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: