Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DA920D236 for ; Wed, 7 Nov 2012 21:26:14 +0000 (UTC) Received: (qmail 22470 invoked by uid 500); 7 Nov 2012 21:26:13 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 22356 invoked by uid 500); 7 Nov 2012 21:26:13 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 22316 invoked by uid 99); 7 Nov 2012 21:26:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Nov 2012 21:26:13 +0000 Date: Wed, 7 Nov 2012 21:26:13 +0000 (UTC) From: "Uwe Schindler (JIRA)" To: dev@lucene.apache.org Message-ID: <1617963684.83367.1352323573471.JavaMail.jiratomcat@arcas> In-Reply-To: <889731223.80680.1352298672353.JavaMail.jiratomcat@arcas> Subject: [jira] [Comment Edited] (LUCENE-4546) SorterTemplate.quicksort incorrect MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LUCENE-4546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13492464#comment-13492464 ] Uwe Schindler edited comment on LUCENE-4546 at 11/7/12 9:25 PM: ---------------------------------------------------------------- Attached the corrected testcase, which passes. -BTW: Your SorterTemplate implementation fails with with mergeSort completely- :-) _(this was incorrect, mergeSort does not use the pivot methods)_ was (Author: thetaphi): Attached the corrected testcase, which passes. BTW: Your SorterTemplate implementation fails with with mergeSort completely :-) > SorterTemplate.quicksort incorrect > ---------------------------------- > > Key: LUCENE-4546 > URL: https://issues.apache.org/jira/browse/LUCENE-4546 > Project: Lucene - Core > Issue Type: Bug > Components: core/other > Affects Versions: 3.6.1, 4.0, 4.1 > Reporter: Stefan Pohl > Assignee: Uwe Schindler > Labels: patch > Fix For: 3.6.1, 4.0, 4.1 > > Attachments: SorterTemplate.java.patch, TestSorterTemplate.java, TestSorterTemplate.java > > > On trying to use the very useful o.a.l.utils.SorterTemplate, I stumbled upon inconsistent sorting behaviour, of course, only a randomized test caught this;) > Because SorterTemplate.quicksort is used in several places in the code (directly BytesRefList, ArrayUtil, BytesRefHash, CollectionUtil and transitively index and search), I'm a bit puzzled that this either hasn't been caught by another higher-level test or that neither my test nor my understanding of an insufficiency in the code is valid;) > If the former holds and given that the same code is released in 3.6 and 4.0, this might even be a more critical issue requiring a higher priority than 'major'. > So, can a second pair of eyes please have a timely look at the attached test and patch? > Basically the current quicksort implementation seems to assume that luckily always the median is chosen as pivot element by grabbing the mid element, not handling the case where the initially chosen pivot ends up not in the middle. Hope this and the test helps to understand the issue. > Reproducible, currently failing test and a patch attached. -- 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 --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org