can  you give me an example where the code will flow to the #3.  ie. creating the ArrayConstructorExpression? In all the cases I tried the flow just goes to the LiteralExpression case? 
That is the reason in my previous pull though I created the ArrayConstructorExpression it was going into the LiteralExpression part.
{code}
ImmutableBytesWritable ptr = context.getTempPtr();
        Object[] elements = new Object[children.size()];
        if(node.isStateless()) {
            for(int i = 0; i < children.size(); i++) {
                Expression child = children.get(i);
                child.evaluate(null, ptr);
                Object value = arrayElemDataType.toObject(ptr, child.getDataType(), child.getColumnModifier());
                elements[i] = LiteralExpression.newConstant(value, child.getDataType()).getValue();
            }
            Object value = PArrayDataType.instantiatePhoenixArray(arrayElemDataType, elements);
            return LiteralExpression.newConstant(value,
                    PDataType.fromTypeId(arrayElemDataType.getSqlType() + Types.ARRAY));
        } else {
            ArrayConstructorExpression arrayExpression = new ArrayConstructorExpression(
                    children, arrayElemDataType);
            for(int i = 0; i < children.size(); i++) {
                Expression child = children.get(i);
                child.evaluate(null, ptr);
            }
            return wrapGroupByExpression(arrayExpression);
        }
{code}
When will the else condition be executed? I need to call PArrayDataType.instantiatePhoenixArray, only then the literal expression will be of type Parray.