David Mollitor created HIVE-23194:
-------------------------------------

             Summary: Use Queue Instead of List for CollectOperator
                 Key: HIVE-23194
                 URL: https://issues.apache.org/jira/browse/HIVE-23194
             Project: Hive
          Issue Type: Improvement
            Reporter: David Mollitor
            Assignee: David Mollitor


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

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

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}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to