[
https://issues.apache.org/jira/browse/PHOENIX-1705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14390631#comment-14390631
]
Dumindu Buddhika commented on PHOENIX-1705:
-------------------------------------------
Thanks for the pointers [~jamestaylor].
I have followed the guidelines.
There are two problems.
{code}
// If the base type of an element is fixed width, make sure the element being
appended will fit
if (getBaseType().isFixedWidth() && getArrayExpr().getMaxLength() !=
null &&
getElementExpr().getMaxLength() != null &&
getElementExpr().getMaxLength() > getArrayExpr().getMaxLength()) {
throw new DataExceedsCapacityException("");
}
{code}
with this condition, the problem I mentioned above occurs. If the following
query is run.
{code}SELECT region_name FROM regions WHERE
ARRAY[2,3,4]=ARRAY_APPEND(ARRAY[2,3],4){code}
code throws a DataExceedsCapacityException. The reason is
getElementExpr().getMaxLength() returns 10 and getArrayExpr().getMaxLength()
returns 4.
{code}
SELECT ARRAY_APPEND(chars,NULL) FROM regions WHERE region_name = 'SF Bay Area'
{code}
When the above query is run, it fails at the coercion check at the constructor.
The reason is, in this example elementType comes as "PVarbinary" so the
coercion check fails(That's why I have left out "PVarbinary" in coercion check
earlier to support this case) . But the expected behavior is this function call
should returns the array itself.
May be these kind of queries are not practically used. So should we ignore them?
> 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_function10.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,
> PHOENIX-1705_implement_ARRAY_APPEND_built_in_function9.patch
>
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)