incubator-jena-dev mailing list archives

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


Stephen Allen commented on JENA-120:

I too expected testReuseQueryObject2 to fail when I wrote it.  However, the reason it doesn't
is a little tricky.  The Aggregator objects (via AggregatorBase) lazily create an Accumulator
for each BindingKey.  When you run the query multiple times, for some reason the BindingKeys
it creates for the same group are not considered equivalent, and thus get added twice to the
buckets object in AggregatorBase.

I don't know if this means that the .equals() and/or .hashCode() are incorrect on BindingKey,
or something else.  Also I'm not quite sure how to modify testReuseQueryObject2 to actually
test for the fact that there are extra Accumulator objects inside the Aggregator, with out
digging into the innards of the object.

> 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
> 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