[
https://issues.apache.org/jira/browse/PHOENIX-1705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14379138#comment-14379138
]
James Taylor commented on PHOENIX-1705:
---------------------------------------
Good point about evaluating the arrayExpression if elementExpr evaluates to
null, [~Dumindux]. Couple minor items (some of which I steered you wrong
before):
- in ArrayAppendFunction.evaluate(), move this code up front, as there's no
reason to do any work if these are the case:
{code}
+ if (!arrayExpr.evaluate(tuple, ptr)) {
+ return false;
+ } else if (ptr.getLength() == 0) {
+ return true;
+ }
+
{code}
- Instead of doing the maxLength check yourself, use
baseType.isSizeCompatible(). This will check the case for scale as well if
applicable. Just use null for the Object value argument - I'm going to remove
that argument soon - it shouldn't really be there.
- Also, you should be able to do a size check in the constructor as well. You'd
want to make sure that the elementDataType.getMaxLength() <=
baseType.getMaxLength() and the same for getScale(). In both cases, you'd only
check this if both are non null.
- The if (!elementDataType.isCastableTo(baseType)) in the constructor should be
if (!baseType.isCoercibleTo(elementDataType)) instead. Otherwise, the
ARRAY_APPEND call should have an explicit cast.
> 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
>
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)