[ 
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_function11.patch

[~jamestaylor]  Thanks for the suggestions on the issues. It worked. For the 
null issue I added a workaround.

About tests with Desc columns. I have added several tests involving Desc 
columns. Tests related to Integer, Varchar, Bigint, Boolean columns pass 
successfully. But tests related to Double and Char columns fail.

For the Double test, Here,
{code}getBaseType().coerceBytes(ptr, null, getElementDataType(), 
getElementExpr().getMaxLength(), getElementExpr().getScale(), 
getElementExpr().getSortOrder(), getArrayExpr().getMaxLength(), 
getArrayExpr().getScale(), getArrayExpr().getSortOrder());
{code}
This should make sure element is inverted according to the array SortOrder. For 
doubles  as I have seen elementBytes does not come to evaluate method 
inverted(I think it should come inverted since it is a Desc column.  integer, 
varchar etc comes inverted as expected). But  coerceBytes method inverts 
element since SortOrders do not match. Because of that appended element is 
inverted.

For the Char case I think coerceBytes method inverts padding bytes(32) also. 
That is the issue. So the appended element becomes some crazy string.

Ex. if the element type is Char(4) and value is  "e" , sort order desc
byte array which comes to evaluate - [-102, 32, 32, 32]
byte array after coerceBytes call in evaluate - [101, -33, -33, -33]

When this is appended to array it is not considered as the expected("e") string 
when reading the array.

Failing two tests related to Desc columns are the last two tests in 
ArrayAppendFunctionsIT class int the latest patch.


> 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_function11.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)

Reply via email to