Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-2333

Sorting by labels in SPARQL query fail

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Jena 2.10.1, Jena 3.16.0, Jena 4.5.0
    • Jena 4.6.0
    • ARQ, Jena
    • None

    Description

      Sorting by labels fail on this data set.

      Simple Java example to reproduce attached.

      Looks like a race condition involved.

      SELECT ?label WHERE {
         ?object <http://www.w3.org/2000/01/rdf-schema#label> ?label . } ORDER BY ASC(?label)
      

       

      java.lang.IllegalArgumentException: Comparison method violates its general contract!
          at java.base/java.util.TimSort.mergeLo(TimSort.java:781)
          at java.base/java.util.TimSort.mergeAt(TimSort.java:518)
          at java.base/java.util.TimSort.mergeCollapse(TimSort.java:448)
          at java.base/java.util.TimSort.sort(TimSort.java:245)
          at java.base/java.util.Arrays.sort(Arrays.java:1441)
          at org.apache.jena.atlas.data.AbortableComparator.abortableSort(AbortableComparator.java:57)
          at org.apache.jena.atlas.data.SortedDataBag.iterator(SortedDataBag.java:205)
          at org.apache.jena.atlas.data.SortedDataBag.iterator(SortedDataBag.java:192)
          at org.apache.jena.sparql.engine.iterator.QueryIterSort$SortedBindingIterator.initializeIterator(QueryIterSort.java:88)
          at org.apache.jena.atlas.iterator.IteratorDelayedInitialization.init(IteratorDelayedInitialization.java:38)
          at org.apache.jena.atlas.iterator.IteratorDelayedInitialization.hasNext(IteratorDelayedInitialization.java:48)
          at org.apache.jena.sparql.engine.iterator.QueryIterPlainWrapper.hasNextBinding(QueryIterPlainWrapper.java:59)
          at org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:114)
          at org.apache.jena.sparql.engine.iterator.QueryIterConvert.hasNextBinding(QueryIterConvert.java:58)
          at org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:114)
          at org.apache.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:38)
          at org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:114)
          at org.apache.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:38)
          at org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:114)
          at org.apache.jena.sparql.exec.RowSetStream.hasNext(RowSetStream.java:47)
          at org.apache.jena.sparql.engine.ResultSetStream.hasNext(ResultSetStream.java:81)
          at test.SortingBug.isReproduced(SortingBug.java:53)
          at test.SortingBug.main(SortingBug.java:39)
      

      Attachments

        1. bad_data_out.n3
          342 kB
          Georgy Litvinov
        2. bad_data_out-56.n3
          3 kB
          Georgy Litvinov
        3. bad_data_out-smallest-19.n3
          3 kB
          Georgy Litvinov
        4. bad_data_to_reproduce_on_TDB1.n3
          203 kB
          Georgy Litvinov
        5. Jena2333_SortingBugArray.java
          2 kB
          Andy Seaborne
        6. SortingBug.java
          2 kB
          Georgy Litvinov

        Activity

          People

            andy Andy Seaborne
            litvinovg Georgy Litvinov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: