[
https://issues.apache.org/jira/browse/PHOENIX-4237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16211282#comment-16211282
]
ASF GitHub Bot commented on PHOENIX-4237:
-----------------------------------------
Github user snakhoda-sfdc commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/275#discussion_r145747600
--- Diff:
phoenix-core/src/main/java/com/ibm/icu/impl/jdkadapter/NumberFormatICU.java ---
@@ -0,0 +1,229 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+/*
+
*******************************************************************************
+ * Copyright (C) 2008, International Business Machines Corporation and
*
+ * others. All Rights Reserved.
*
+
*******************************************************************************
+ */
+package com.ibm.icu.impl.jdkadapter;
+
+import java.math.RoundingMode;
+import java.text.FieldPosition;
+import java.text.ParseException;
+import java.text.ParsePosition;
+import java.util.Currency;
+
+import com.ibm.icu.impl.icuadapter.NumberFormatJDK;
+import com.ibm.icu.text.NumberFormat;
+
+/**
+ * NumberFormatICU is an adapter class which wraps ICU4J NumberFormat and
+ * implements java.text.NumberFormat APIs.
+ */
+public class NumberFormatICU extends java.text.NumberFormat {
+
+ private static final long serialVersionUID = 4892903815641574060L;
+
+ private NumberFormat fIcuNfmt;
+
+ private NumberFormatICU(NumberFormat icuNfmt) {
+ fIcuNfmt = icuNfmt;
+ }
+
+ public static java.text.NumberFormat wrap(NumberFormat icuNfmt) {
+ if (icuNfmt instanceof NumberFormatJDK) {
+ return ((NumberFormatJDK)icuNfmt).unwrap();
+ }
+ return new NumberFormatICU(icuNfmt);
+ }
+
+ public NumberFormat unwrap() {
+ return fIcuNfmt;
+ }
+
+ @Override
+ public Object clone() {
+ NumberFormatICU other = (NumberFormatICU)super.clone();
+ other.fIcuNfmt = (NumberFormat)fIcuNfmt.clone();
+ return other;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof NumberFormatICU) {
+ return ((NumberFormatICU)obj).fIcuNfmt.equals(fIcuNfmt);
+ }
+ return false;
+ }
+
+ //public String format(double number)
--- End diff --
Thanks for taking a look at this PR, @solzy. This code is external and
simply copied over from ICU4J 59.1. The reason it's here at all is that that
project doesn't have all its artifacts in maven. I'm hoping to have a new PR in
the near future to remove this external code and replace it with maven
dependencies. CC: @JamesRTaylor
> Allow sorting on (Java) collation keys for non-English locales
> --------------------------------------------------------------
>
> Key: PHOENIX-4237
> URL: https://issues.apache.org/jira/browse/PHOENIX-4237
> 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
(v6.4.14#64029)