Class TransformDistinctToReduced
- java.lang.Object
-
- org.apache.jena.sparql.algebra.TransformCopy
-
- org.apache.jena.sparql.algebra.optimize.TransformDistinctToReduced
-
- All Implemented Interfaces:
Transform
public class TransformDistinctToReduced extends TransformCopy
Transforms generic
DISTINCTplusORDER BYcombinations toREDUCEDplusORDER BYwhich typically gives better performance and memory consumption because engines have to keep less data in-memory to evaluate it.As with most optimizations this is only applied when it is safe to do so. The criteria for being safe to do so are as follows:
- Uses both
ORDER BYandDISTINCTon the same level of the query - There is a fixed list of variables to project i.e. not
SELECT * ORDER BYconditions cover all the projected variables prior to the use of any other variables
Related Optimizations
See also
TransformOrderByDistinctApplicationwhich is a better optimization for these kinds of queries but only applies to a more limited range of queries. Where possible that optimization is applied in preference to this one.TransformTopNcovers the case ofDISTINCTplusORDER BYwhere there is also aLIMIT. Where possible that optimization is applied in preference to either this orTransformOrderByDistinctApplication.
-
-
Field Summary
-
Fields inherited from class org.apache.jena.sparql.algebra.TransformCopy
COPY_ALWAYS, COPY_ONLY_ON_CHANGE
-
-
Constructor Summary
Constructors Constructor Description TransformDistinctToReduced()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optransform(OpDistinct opDistinct, Op subOp)Optransform1(OpDistinct opDistinct, 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, transform
-
-
-
-
Method Detail
-
transform1
public Op transform1(OpDistinct opDistinct, Op subOp)
-
transform
public Op transform(OpDistinct opDistinct, Op subOp)
- Specified by:
transformin interfaceTransform- Overrides:
transformin classTransformCopy
-
-