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

Use Queue Instead of List for CollectOperator

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.0
    • Component/s: None
    • Labels:
      None
    • Target Version/s:

      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

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

              Dates

              • Created:
                Updated:
                Resolved: