incubator-jena-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Allen (JIRA)" <>
Subject [jira] [Updated] (JENA-120) Query objects with aggregators cannot be reused
Date Wed, 21 Sep 2011 15:49:09 GMT


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 ( 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:
>             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]

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message