public class TransformOrderByDistinctAppplication extends TransformCopy
Improved optimization for ORDER BY
plus DISTINCT
or
REDUCED
combinations, see JENA-441 for original proposal and
discussion.
This optimization is enabled by default as with most ARQ optimizations and
may be disabled by setting the symbol
ARQ.optOrderByDistinctApplication
to false.
This is a limited optimization that applies in the case where you have a query that meets the following conditions:
ORDER BY
and DISTINCT
or REDUCED
on the
same level of the querySELECT *
ORDER BY
conditions only use variables present in the project
listEssentially this takes algebras of the following form:
(distinct (project (?var) (order (?var) ... )))
And produces algebra of the following form:
(order (?var) (distinct (project (?var) ... )))
In the general case this in unsafe because it would change the semantics of
the query since ORDER BY
can access variables that are not projected.
However if the conditions outlined are met then this optimization is safe,
the algebras will be semantically equivalent and the resulting form likely
significantly more performant, of course YMMV depending on how much data you
are querying.
COPY_ALWAYS, COPY_ONLY_ON_CHANGE
Constructor and Description |
---|
TransformOrderByDistinctAppplication() |
Modifier and Type | Method and Description |
---|---|
Op |
transform(OpDistinct opDistinct,
Op subOp) |
Op |
transform(OpReduced opReduced,
Op subOp) |
transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform
public TransformOrderByDistinctAppplication()
public Op transform(OpDistinct opDistinct, Op subOp)
transform
in interface Transform
transform
in class TransformCopy
Licenced under the Apache License, Version 2.0