private static byte[] callFunction(LiteralExpression inputStrLiteral, LiteralExpression localeIsoCodeLiteral, LiteralExpression upperCaseBooleanLiteral, LiteralExpression strengthLiteral, LiteralExpression decompositionLiteral) 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); byte[] result = ret ? (byte[]) collationKeyFunction.getDataType().toObject(ptr, collationKeyFunction.getSortOrder()) : null; return result; } }