Return-Path: X-Original-To: apmail-incubator-jena-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-jena-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C79D29947 for ; Wed, 21 Sep 2011 15:49:30 +0000 (UTC) Received: (qmail 99566 invoked by uid 500); 21 Sep 2011 15:49:30 -0000 Delivered-To: apmail-incubator-jena-dev-archive@incubator.apache.org Received: (qmail 99533 invoked by uid 500); 21 Sep 2011 15:49:30 -0000 Mailing-List: contact jena-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jena-dev@incubator.apache.org Delivered-To: mailing list jena-dev@incubator.apache.org Received: (qmail 99521 invoked by uid 99); 21 Sep 2011 15:49:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Sep 2011 15:49:30 +0000 X-ASF-Spam-Status: No, hits=-2000.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Sep 2011 15:49:29 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 2E5BDA6B5E for ; Wed, 21 Sep 2011 15:49:09 +0000 (UTC) Date: Wed, 21 Sep 2011 15:49:09 +0000 (UTC) From: "Stephen Allen (JIRA)" To: jena-dev@incubator.apache.org Message-ID: <1311846231.51051.1316620149186.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <922552960.46560.1316534048930.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (JENA-120) Query objects with aggregators cannot be reused 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/JENA-120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Stephen Allen updated JENA-120: ------------------------------- Attachment: JENA-120-r1173729.patch Ah, the BindingKeys are not considered equal because they can mutate! This is probably not what we want (and in particular it's a bad idea to mutate keys in a hashtable). Since BindingKey only maintains a reference to the binding, when the aggregation is added to the binding as an additional variable/value pair (QueryIterGroup.java line 141) it changes the .equals() and .hashCode() values. I've attached a patch that stores a copy of the binding in BindingKey rather than a reference. This causes testReuseQueryObject2 to fail without the initial patch and pass when it is applied. > Query objects with aggregators cannot be reused > ----------------------------------------------- > > Key: JENA-120 > URL: https://issues.apache.org/jira/browse/JENA-120 > Project: Jena > Issue Type: Bug > Components: ARQ > Reporter: Stephen Allen > Assignee: Andy Seaborne > Priority: Minor > Attachments: JENA-120-r1173178.patch, JENA-120-r1173729.patch > > > Query objects that contain aggregators (Group By) cannot be reused by different threads because the internal state is mutable. Even reusing a query object in the same thread has problems, because it creates a new Aggregator object each time you execute the query. Users may want to reuse Query objects to save having to reparse the query string. > I believe the solution is to copy the aggregators when compiling the query. I've attached a patch that does that in the AlgebraGenerator.compileModifiers() method. > See the thread at [1] for more discussion. > [1] http://mail-archives.apache.org/mod_mbox/incubator-jena-users/201109.mbox/%3CB60ACA3A-DB31-4FEC-A72E-D81A5C2AB41A@knublauch.com%3E -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira