Github user JamesRTaylor commented on a diff in the pull request:

    https://github.com/apache/incubator-phoenix/pull/8#discussion_r10000713
  
    --- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/expression/ArrayConstructorExpression.java
 ---
    @@ -39,18 +33,31 @@
         private PDataType baseType;
         private int position = -1;
         private Object[] elements;
    -    
    -    
    +    private TrustedByteArrayOutputStream byteStream = null;
    +    private DataOutputStream oStream = null;
    +    private int estimatedSize = 0;
    +    // store the offset postion in this.  Later based on the total size 
move this to a byte[]
    +    // and serialize into byte stream
    +    private int[] offsetPos;
    +
         public ArrayConstructorExpression(List<Expression> children, PDataType 
baseType) {
             super(children);
             init(baseType);
    +        estimatedSize = PArrayDataType.estimateSize(this.children.size(), 
this.baseType);
    +        if (!this.baseType.isFixedWidth()) {
    +            offsetPos = new int[children.size()];
    +            byteStream = new TrustedByteArrayOutputStream(estimatedSize * 
ValueSchema.ESTIMATED_VARIABLE_LENGTH_SIZE);
    --- End diff --
    
    Do this estimatedSize * ValueSchema.ESTIMATED_VARIABLE_LENGTH_SIZE for the 
case of variable length in PArrayDataType.estimateSize() instead so it doesn't 
leak out to the client.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to