incubator-jena-dev mailing list archives

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


Andy Seaborne commented on JENA-120:

I tried the new tests on the existing code base (no patch to AlgebraGenerator) and they passed.
 I expected testReuseQueryObject2 to fail.

The patch looks right.  Expressions (interface Expr) should be just structural, with no state
and no concurrency problems.  ExprAggregator violates that via its Aggregator.  A copy in
AlgebraGenerator as per the patch may be the best way to resolve it.

Aggregators capture two thing - the operation (count(*) etc and the state.  Maybe state-per-excution
needs to be better handled and a more general place for state put in.  (e.g. some caching).
 At the moment, there isn't such a place.  ExecutionContext is the obvious place to put such
state.  State would be initialized at the start of query executuion.  QueryExecution objects
are use-once.

Query and algebra expressions would be reusable.

> 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