[ https://issues.apache.org/jira/browse/PHOENIX-1705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14352384#comment-14352384 ]
James Taylor commented on PHOENIX-1705: --------------------------------------- Good start, [~Dumindux], and good feedback, [~sergey.b]. Besides these things, you'll also want to handle arrays with variable length. In general, don't allocate new byte arrays or other objects during evaluate unless absolutely necessary. For example: {code} + byte[] elementBytes = Arrays.copyOfRange(source,elementOffset,elementOffset+elementLength); {code} No need for this copy. You'll basically want to allocate a new array of the correct size, copy the existing bytes into it and then copy the new element into it. Things you'll need to handle: - If the element is an array, copy all the elements of the array to the end of the existing arrray. - If the type of the array element doesn't match the type of the element being appended, you'll need to coerce (use PDataType.coerceBytes) the type to match if sourceType.isCastableTo(targetType) is true. - We know the types at compile time (which is basically when the constructor is called), so any type checking should be done there, as opposed to during evaluate (which gets called once per row as a query is being evaluated). > 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 > > -- This message was sent by Atlassian JIRA (v6.3.4#6332)