apache / lucene

Apache Lucene open-source search software
https://lucene.apache.org/
Apache License 2.0
2.59k stars 1.01k forks source link

TestCollationDocValuesField.testRanges failure [LUCENE-6206] #7268

Open asfimport opened 9 years ago

asfimport commented 9 years ago

This test failed in branch_5x:

ant test  -Dtestcase=TestCollationDocValuesField -Dtests.method=testRanges -Dtests.seed=8729A11DAE9AE179 -Dtests.multiplier=3 -Dtests.slow=true -Dtests.locale=lt -Dtests.timezone=Etc/GMT-8 -Dtests.asserts=true -Dtests.file.encoding=UTF-8

The problem is, with lithuanian collator, the generated collationkey does not agree with collation order.

In other words: collator.compare("yi", "iy") != collator.getCollationKey("yi").compareTo(collator.getCollationKey("iy"))

Simple test:

import java.text.Collator;
import java.util.Locale;

public class TestLithuanian {
  public static void main(String args[]) throws Exception {
    Collator collator = Collator.getInstance(new Locale("lt"));
    int value = collator.compare("yi", "iy");
    System.out.println(value); // returns 1
    int value2 = collator.getCollationKey("yi").compareTo(collator.getCollationKey("iy"));
    System.out.println(value2); // returns -1
  }
}

Note that if you change java.text.Collator to com.ibm.icu.text.Collator, they are consistent. Looks like a bug in JDK collation.


Migrated from LUCENE-6206 by Robert Muir (@rmuir), updated Aug 31 2015

asfimport commented 9 years ago

ASF subversion and git services (migrated from JIRA)

Commit 1655657 from @rmuir in branch 'dev/branches/branch_5x' https://svn.apache.org/r1655657

LUCENE-6206: don't fail test if it encounters jdk bug

asfimport commented 9 years ago

ASF subversion and git services (migrated from JIRA)

Commit 1655659 from @rmuir in branch 'dev/trunk' https://svn.apache.org/r1655659

LUCENE-6206: don't fail test if it encounters jdk bug

asfimport commented 9 years ago

Robert Muir (@rmuir) (migrated from JIRA)

I opened a java bug report (Review ID: JI-9018602) and fixed our tests to not fail when its a jdk bug.

asfimport commented 9 years ago

Steven Rowe (@sarowe) (migrated from JIRA)

Here's the JIRA corresponding to JI-9018602: https://bugs.openjdk.java.net/browse/JDK-8071862

asfimport commented 9 years ago

ASF subversion and git services (migrated from JIRA)

Commit 1655708 from @rmuir in branch 'dev/trunk' https://svn.apache.org/r1655708

LUCENE-6206: link to jdk bug, tighten up the assume

asfimport commented 9 years ago

ASF subversion and git services (migrated from JIRA)

Commit 1655709 from @rmuir in branch 'dev/branches/branch_5x' https://svn.apache.org/r1655709

LUCENE-6206: link to jdk bug, tighten up the assume

asfimport commented 9 years ago

Robert Muir (@rmuir) (migrated from JIRA)

Here's the JIRA corresponding to JI-9018602: https://bugs\.openjdk\.java\.net/browse/JDK-8071862

Thanks Steve.

asfimport commented 9 years ago

ASF subversion and git services (migrated from JIRA)

Commit 1700261 from @rmuir in branch 'dev/trunk' https://svn.apache.org/r1700261

LUCENE-6206: don't fail test if it encounters jdk bug, ban Collator.compare in tests so this never pops again

asfimport commented 9 years ago

ASF subversion and git services (migrated from JIRA)

Commit 1700266 from @rmuir in branch 'dev/branches/branch_5x' https://svn.apache.org/r1700266

LUCENE-6206: don't fail test if it encounters jdk bug, ban Collator.compare in tests so this never pops again

asfimport commented 9 years ago

Michael McCandless (@mikemccand) (migrated from JIRA)

Woops, thanks @rmuir!