Class TransformOrderByDistinctApplication
- java.lang.Object
-
- org.apache.jena.sparql.algebra.TransformCopy
-
- org.apache.jena.sparql.algebra.optimize.TransformOrderByDistinctApplication
-
- All Implemented Interfaces:
Transform
public class TransformOrderByDistinctApplication extends TransformCopy
Improved optimization for
ORDER BYplusDISTINCTorREDUCEDcombinations, 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.optOrderByDistinctApplicationto false.Optimization Applicability
This is a limited optimization that applies in the case where you have a query that meets the following conditions:
- Uses both
ORDER BYandDISTINCTorREDUCEDon the same level of the query - There is a fixed list of variables to project i.e. not
SELECT * ORDER BYconditions only use variables present in the project list
Essentially 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 BYcan 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.
-
-
Field Summary
-
Fields inherited from class org.apache.jena.sparql.algebra.TransformCopy
COPY_ALWAYS, COPY_ONLY_ON_CHANGE
-
-
Constructor Summary
Constructors Constructor Description TransformOrderByDistinctApplication()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optransform(OpDistinct opDistinct, Op subOp)Optransform(OpReduced opReduced, Op subOp)-
Methods inherited from class org.apache.jena.sparql.algebra.TransformCopy
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, transform
-
-
-
-
Method Detail
-
transform
public Op transform(OpDistinct opDistinct, Op subOp)
- Specified by:
transformin interfaceTransform- Overrides:
transformin classTransformCopy
-
-