[
https://issues.apache.org/jira/browse/PHOENIX-1705?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dumindu Buddhika updated PHOENIX-1705:
--------------------------------------
Attachment: PHOENIX-1705_implement_ARRAY_APPEND_built_in_function4.patch
Hi, [~jamestaylor],
Thanks for the feedback.
I have improved the code according to the feedback.
{code}
if (baseType.isFixedWidth())
+ {
+ int
arrayElementLength=getMaxLength()==null?baseType.getByteSize():getMaxLength();
+
+ if(ptr.getLength()>arrayElementLength)
+ {
+ return false;
+ }
+
+ }
{code}
I used above code to check whether the element to be added can be accommodated
within the array baseType. the last test in the endtoend test file covers it.
For example if a number larger than Integer is added to an Integer array,
directly coercing it will result in an incorrect number. I used it to detect
that. But not sure its the best way to do it.
I have also added a separate test file to directly test the
function(ArrayAppendFunctionTest).
Thanks for reminding that last test. Actually I have missed that case when
writing the code earlier. Now I have changed the code to handle that case and
added a test case also to verify it(in ArrayAppendFunctionTest).
> 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
>
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)