This is an automated email from the ASF dual-hosted git repository.

hashutosh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 15ebf9e  HIVE-23194 : Use Queue Instead of List for CollectOperator 
(David Mollitor via Ashutosh Chauhan)
15ebf9e is described below

commit 15ebf9e208f56b0e54ed513bff099473683dc6eb
Author: David Mollitor <dmolli...@apache.org>
AuthorDate: Fri Apr 17 20:48:08 2020 -0700

    HIVE-23194 : Use Queue Instead of List for CollectOperator (David Mollitor 
via Ashutosh Chauhan)
    
    Signed-off-by: Ashutosh Chauhan <hashut...@apache.org>
---
 ql/src/java/org/apache/hadoop/hive/ql/exec/CollectOperator.java | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/CollectOperator.java 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/CollectOperator.java
index 2ec9a4f..df69bf2 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/CollectOperator.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/CollectOperator.java
@@ -19,7 +19,8 @@
 package org.apache.hadoop.hive.ql.exec;
 
 import java.io.Serializable;
-import java.util.ArrayList;
+import java.util.ArrayDeque;
+import java.util.Queue;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hive.ql.CompilationOpContext;
@@ -37,7 +38,7 @@ public class CollectOperator extends Operator<CollectDesc> 
implements
     Serializable {
 
   private static final long serialVersionUID = 1L;
-  protected transient ArrayList<Object> rowList;
+  protected transient Queue<Object> rowList;
   protected transient ObjectInspector standardRowInspector;
   transient int maxSize;
 
@@ -53,7 +54,7 @@ public class CollectOperator extends Operator<CollectDesc> 
implements
   @Override
   protected void initializeOp(Configuration hconf) throws HiveException {
     super.initializeOp(hconf);
-    rowList = new ArrayList<Object>();
+    this.rowList = new ArrayDeque<>();
     maxSize = conf.getBufferSize().intValue();
   }
 
@@ -83,7 +84,7 @@ public class CollectOperator extends Operator<CollectDesc> 
implements
       result.o = null;
       result.oi = null;
     } else {
-      result.o = rowList.remove(0);
+      result.o = rowList.poll();
       result.oi = standardRowInspector;
     }
   }

Reply via email to