[ https://issues.apache.org/jira/browse/PHOENIX-1705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14379336#comment-14379336 ]
James Taylor commented on PHOENIX-1705: --------------------------------------- bq. If this is moved up ptr will be pointed to array rather than the element. But there are some operations which are done using ptr to the element(such as padding, size checking, coercing). So how do we go about that? The ptr is set when evaluate is called. You never need to call evaluate on the element if you're returning, so do the array evaluation first. After evaluating the arrayElementExpr, set local variables for the byte[], offset, and length. Then evaluate the elementExpr and ptr will be set to that for the reset of the method. bq. if (!elementDataType.isCastableTo(baseType)) is changed to (!baseType.isCoercibleTo(elementDataType)) cases like following fails where an integer added to a double array. Do the other way around (sorry - had the wrong in my previous message): elementDataType.isCoercibleTo(baseType). You want to make sure that the element being added can be coerced to the type of the elements in the array. bq. here dataType.getMaxLength() needs an object passed in as an argument Don't use the PDataType.getMaxLength(Object), use the arrayExpr.getMaxLength(), and elementExpr.getMaxLength(). Only do the max length check if baseType.isFixedWidth() is true. - Don't use member variables for these, as you'd need to re-establish them when the function is serialized and executed on the server. In that case, the default constructor is used and readFields() sets the children member variables. In this case, just create a getElementExpr() and getArrayExpr() methods and call them once in evaluate. Same with baseType. {code} + elementExpr = children.get(1); + arrayExpr = children.get(0); + baseType = PDataType.arrayBaseType(arrayExpr.getDataType()); + elementDataType = elementExpr.getDataType(); {code} > implement ARRAY_APPEND built in function > ---------------------------------------- > > Key: PHOENIX-1705 > URL: https://issues.apache.org/jira/browse/PHOENIX-1705 > Project: Phoenix > Issue Type: Sub-task > Reporter: Dumindu Buddhika > Assignee: Dumindu Buddhika > Attachments: > PHOENIX-1705_implement_ARRAY_APPEND_built_in_function.patch, > PHOENIX-1705_implement_ARRAY_APPEND_built_in_function.patch, > PHOENIX-1705_implement_ARRAY_APPEND_built_in_function1.patch, > PHOENIX-1705_implement_ARRAY_APPEND_built_in_function2.patch, > PHOENIX-1705_implement_ARRAY_APPEND_built_in_function3.patch, > PHOENIX-1705_implement_ARRAY_APPEND_built_in_function4.patch, > PHOENIX-1705_implement_ARRAY_APPEND_built_in_function5.patch, > PHOENIX-1705_implement_ARRAY_APPEND_built_in_function6.patch, > PHOENIX-1705_implement_ARRAY_APPEND_built_in_function7.patch, > PHOENIX-1705_implement_ARRAY_APPEND_built_in_function8.patch > > -- This message was sent by Atlassian JIRA (v6.3.4#6332)