Why would you sort by some random value?

Perhaps we need a new resolution code of "Don't do that"


On Thu, Sep 26, 2013 at 11:22 AM, Andy Seaborne (JIRA) <[email protected]>wrote:

>
>     [
> https://issues.apache.org/jira/browse/JENA-506?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13778635#comment-13778635]
>
> Andy Seaborne commented on JENA-506:
> ------------------------------------
>
> It seems hard to do anything when sorting by anything that is not a true
> function (result is purely determined by it's arguments) other than to say
> "don't do that".
>
>
> > SPARQL "ORDER BY RAND()" may lead to a "Comparison method violates its
> general contract!" exception
> >
> ----------------------------------------------------------------------------------------------------
> >
> >                 Key: JENA-506
> >                 URL: https://issues.apache.org/jira/browse/JENA-506
> >             Project: Apache Jena
> >          Issue Type: Bug
> >          Components: ARQ
> >    Affects Versions: Jena 2.10.1
> >         Environment: OpenJDK 1.7.0_21 (64)
> >            Reporter: Pasquale Minervini
> >
> > It seems like the SPARQL "SELECT [..] ORDER BY RAND()" query construct
> can cause troubles when retrieving results; here's a complete stacktrace
> (Specifically, I've been querying the DBLP RDF dataset:
> http://sw.deri.org/~aharth/2004/07/dblp/). I think the construct can be
> quite useful for randomly sampling nodes from the RDF graph, that's the
> reason for the 'Critical'.
> > ARQ:        VERSION: 2.10.1
> > ARQ:        BUILD_DATE: 2013-05-11T22:05:51+0100
> > Exception in thread "main" java.lang.IllegalArgumentException:
> Comparison method violates its general contract!
> >         at java.util.TimSort.mergeLo(TimSort.java:747)
> >         at java.util.TimSort.mergeAt(TimSort.java:483)
> >         at java.util.TimSort.mergeCollapse(TimSort.java:408)
> >         at java.util.TimSort.sort(TimSort.java:214)
> >         at java.util.TimSort.sort(TimSort.java:173)
> >         at java.util.Arrays.sort(Arrays.java:659)
> >         at
> org.apache.jena.atlas.data.SortedDataBag.iterator(SortedDataBag.java:204)
> >         at
> org.apache.jena.atlas.data.SortedDataBag.iterator(SortedDataBag.java:189)
> >         at
> com.hp.hpl.jena.sparql.engine.iterator.QueryIterSort$SortedBindingIterator.initializeIterator(QueryIterSort.java:99)
> >         at
> org.apache.jena.atlas.iterator.IteratorDelayedInitialization.init(IteratorDelayedInitialization.java:40)
> >         at
> org.apache.jena.atlas.iterator.IteratorDelayedInitialization.hasNext(IteratorDelayedInitialization.java:50)
> >         at
> com.hp.hpl.jena.sparql.engine.iterator.QueryIterPlainWrapper.hasNextBinding(QueryIterPlainWrapper.java:54)
> >         at
> com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
> >         at
> com.hp.hpl.jena.sparql.engine.iterator.QueryIterSlice.hasNextBinding(QueryIterSlice.java:76)
> >         at
> com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
> >         at
> com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:40)
> >         at
> com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
> >         at
> com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:40)
> >         at
> com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
> >         at
> com.hp.hpl.jena.sparql.engine.ResultSetStream.hasNext(ResultSetStream.java:75)
> > I can easily provide a snippet if you really need it.
>
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA
> administrators
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>



-- 
I like: Like Like - The likeliest place on the web<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren

Reply via email to