[ 
https://issues.apache.org/jira/browse/PHOENIX-4843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16576969#comment-16576969
 ] 

James Taylor commented on PHOENIX-4843:
---------------------------------------

Nasty bug - nice find, [~tdsilva]. Minor nit on the patch. Use 
ImmutableBytesWritable instead of ImmutableBytesPtr as the latter has a higher 
cost of computing and storing the hashcode which you don't need to produce the 
string.
{code:java}
         for (ImmutableBytesPtr value : values) {
+            ImmutableBytesPtr currValue = value;
             if (firstChild.getSortOrder() != null) {
-                type.coerceBytes(value, type, firstChild.getSortOrder(), 
SortOrder.getDefault());
+                // if we are need to invert the bytes create a copy so that 
the byte[] in values are not affected
+                if (!firstChild.getSortOrder().equals(SortOrder.getDefault())) 
{
+                    currValue = new ImmutableBytesPtr(value.copyBytes());
+                }
+                type.coerceBytes(currValue, type, firstChild.getSortOrder(),
+                    SortOrder.getDefault());
{code}

> InListExpression toString() converts the values in the list to ASC sort order 
> always
> ------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-4843
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-4843
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Thomas D'Silva
>            Assignee: Thomas D'Silva
>            Priority: Major
>             Fix For: 4.15.0, 5.1.0
>
>         Attachments: PHOENIX-4843-v2.patch, PHOENIX-4843-v3.patch, 
> PHOENIX-4843.patch
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to