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

Dumindu Buddhika commented on PHOENIX-1863:
-------------------------------------------

[~jamestaylor]
bq. For example test the sort order for a CHAR(5) that's DESC and ASC wrt to 
byte[] (you can use Bytes.BYTE_COMPARATOR) for the following kinds of values:
I do not clearly understand the above. Do you mean a following kind of a test? 
:)

{code}
PDataType dataType = PChar.INSTANCE;
String str = "foo";
byte[] result = new byte[]{-103, -112, -112, -33, -33, -33, -33, -33};
LiteralExpression expr = LiteralExpression.newConstant(str, dataType, 5, null, 
SortOrder.DESC, Determinism.ALWAYS);
ImmutableBytesPtr ptr = new ImmutableBytesPtr(expr.getBytes());
dataType.pad(ptr, 8, SortOrder.DESC);
String resultValue = (String) dataType.toObject(ptr, dataType, SortOrder.DESC);
assertTrue(Arrays.equals(result, ptr.get()));
assertEquals(str, resultValue);
{code}

I also found that, StringUtil.padChar also does not care about the SortOrder. 
StringUtil.padChar  is used in LiteralExpression.newConstant method. So the 
above test case does not pass actually.

> Create unit test for inverting the pad character
> ------------------------------------------------
>
>                 Key: PHOENIX-1863
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1863
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: James Taylor
>            Assignee: Dumindu Buddhika
>             Fix For: 5.0.0, 4.4.0
>
>         Attachments: PHOENIX-1863.patch
>
>
> It'd be good to have unit tests that test the necessity of inverting the pad 
> character (the parent JIRA).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to