Github user snakhoda-sfdc commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/275#discussion_r145257151
--- Diff:
phoenix-core/src/test/java/org/apache/phoenix/expression/function/CollationKeyFunctionTest.java
---
@@ -96,33 +96,35 @@ private static boolean testExpression(String inputStr,
String localeIsoCode, Sor
strengthLiteral = LiteralExpression.newConstant(null,
PInteger.INSTANCE, sortOrder);
decompositionLiteral = LiteralExpression.newConstant(null,
PInteger.INSTANCE, sortOrder);
boolean ret = testExpression(inputStrLiteral,
localeIsoCodeLiteral, upperCaseBooleanLiteral, strengthLiteral,
- decompositionLiteral, new
PhoenixArray(PInteger.INSTANCE, expectedCollationKeyBytes));
+ decompositionLiteral,
expectedCollationKeyBytesHex);
return ret;
}
private static boolean testExpression(LiteralExpression
inputStrLiteral, LiteralExpression localeIsoCodeLiteral,
LiteralExpression upperCaseBooleanLiteral,
LiteralExpression strengthLiteral,
- LiteralExpression decompositionLiteral, PhoenixArray
expectedCollationKeyByteArray) throws SQLException {
+ LiteralExpression decompositionLiteral, String
expectedCollationKeyBytesHex) throws Exception {
List<Expression> expressions = Lists.newArrayList((Expression)
inputStrLiteral,
(Expression) localeIsoCodeLiteral, (Expression)
upperCaseBooleanLiteral, (Expression) strengthLiteral,
(Expression) decompositionLiteral);
Expression collationKeyFunction = new
CollationKeyFunction(expressions);
ImmutableBytesWritable ptr = new ImmutableBytesWritable();
boolean ret = collationKeyFunction.evaluate(null, ptr);
if (ret) {
- PhoenixArray result = (PhoenixArray)
collationKeyFunction.getDataType().toObject(ptr,
+ byte[] result = (byte[])
collationKeyFunction.getDataType().toObject(ptr,
collationKeyFunction.getSortOrder());
+ byte[] expectedCollationKeyByteArray =
Hex.decodeHex(expectedCollationKeyBytesHex.toCharArray());
+
--- End diff --
Good point. Will do.
---