You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by al...@apache.org on 2019/03/22 17:13:32 UTC

[asterixdb] branch master updated: [NO ISSUE][RT] Fix list builder to re use object

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 4f30aa1  [NO ISSUE][RT] Fix list builder to re use object
4f30aa1 is described below

commit 4f30aa1d2b52fe0f8b242b95cee9f823f48b5822
Author: Ali Alsuliman <al...@gmail.com>
AuthorDate: Thu Mar 21 23:15:50 2019 -0700

    [NO ISSUE][RT] Fix list builder to re use object
    
    - user model changes: no
    - storage format changes: no
    - interface changes: no
    
    Details:
    When the list builder is reset, the offsets byte array
    is set to null which causes it to be created again
    when writing the list out. Avoid setting it to null in
    reset.
    
    Change-Id: I43bdfa514d9c78cfb7dfda009d0ea678ad846eba
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/3287
    Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Contrib: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Reviewed-by: Michael Blow <mb...@apache.org>
---
 .../apache/asterix/builders/AbstractListBuilder.java    | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/builders/AbstractListBuilder.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/builders/AbstractListBuilder.java
index 35f6170..04e3e67 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/builders/AbstractListBuilder.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/builders/AbstractListBuilder.java
@@ -32,16 +32,15 @@ import org.apache.hyracks.data.std.util.GrowableArray;
 import org.apache.hyracks.storage.common.arraylist.IntArrayList;
 
 public abstract class AbstractListBuilder implements IAsterixListBuilder {
+    protected final ATypeTag listType;
     protected final GrowableArray outputStorage;
-    protected final DataOutputStream outputStream;
     protected final IntArrayList offsets;
-    protected int metadataInfoSize;
-    protected byte[] offsetArray;
-    protected int offsetPosition;
-    protected int headerSize;
-    protected ATypeTag itemTypeTag;
-    protected final ATypeTag listType;
-
+    private final DataOutputStream outputStream;
+    private int metadataInfoSize;
+    private byte[] offsetArray;
+    private int offsetPosition;
+    private int headerSize;
+    private ATypeTag itemTypeTag;
     protected boolean fixedSize = false;
     protected int numberOfItems;
 
@@ -58,7 +57,6 @@ public abstract class AbstractListBuilder implements IAsterixListBuilder {
     @Override
     public void reset(AbstractCollectionType listType) {
         this.outputStorage.reset();
-        this.offsetArray = null;
         this.offsets.clear();
         this.offsetPosition = 0;
         this.numberOfItems = 0;
@@ -79,7 +77,6 @@ public abstract class AbstractListBuilder implements IAsterixListBuilder {
             byte[] data = item.getByteArray();
             int start = item.getStartOffset();
             int len = item.getLength();
-
             byte serializedTypeTag = data[start];
             if (!fixedSize && ((serializedTypeTag != ATypeTag.SERIALIZED_NULL_TYPE_TAG
                     && serializedTypeTag != ATypeTag.SERIALIZED_MISSING_TYPE_TAG) || itemTypeTag == ATypeTag.ANY)) {