phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (PHOENIX-4237) Allow sorting on (Java) collation keys for non-English locales
Date Thu, 12 Oct 2017 21:34:00 GMT


ASF GitHub Bot commented on PHOENIX-4237:

Github user JamesRTaylor commented on a diff in the pull request:
    --- Diff: phoenix-core/src/test/java/org/apache/phoenix/expression/function/
    @@ -0,0 +1,134 @@
    +package org.apache.phoenix.expression.function;
    +import static org.junit.Assert.assertEquals;
    +import static;
    +import java.sql.SQLException;
    +import java.util.List;
    +import org.apache.phoenix.expression.function.CollationKeyFunction;
    +import org.apache.phoenix.schema.SortOrder;
    +import org.apache.phoenix.schema.types.PBoolean;
    +import org.apache.phoenix.schema.types.PInteger;
    +import org.apache.phoenix.schema.types.PVarchar;
    +import org.apache.phoenix.schema.types.PhoenixArray;
    +import org.apache.phoenix.expression.Expression;
    +import org.apache.phoenix.expression.LiteralExpression;
    +import org.junit.Test;
    + * "Unit" tests for CollationKeyFunction
    + * 
    + * @author snakhoda
    + *
    + */
    +public class CollationKeyFunctionTest {
    --- End diff --
    We'll need more tests. You really want to test the sort order of a list of strings matches
the expected linguistic sort order. These tests don't have a lot of meaning in terms of validating
the sort order is correct IMHO.
    We'll also want end2end tests that use the new function.

> Allow sorting on (Java) collation keys for non-English locales
> --------------------------------------------------------------
>                 Key: PHOENIX-4237
>                 URL:
>             Project: Phoenix
>          Issue Type: Improvement
>            Reporter: Shehzaad Nakhoda
>             Fix For: 4.12.0
> Strings stored via Phoenix can be composed from a subset of the entire set of Unicode
characters. The natural sort order for strings for different languages often differs from
the order dictated by the binary representation of the characters of these strings. Java provides
the idea of a Collator which given an input string and a (language) locale can generate a
Collation Key which can then be used to compare strings in that natural order.
> Salesforce has recently open-sourced grammaticus. IBM has open-sourced ICU4J some time
ago. These technologies can be combined to provide a robust new Phoenix function that can
be used in an ORDER BY clause to sort strings according to the user's locale.

This message was sent by Atlassian JIRA

View raw message