Class TransformOrderByDistinctApplication
- All Implemented Interfaces:
Transform
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.
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 BY
andDISTINCT
orREDUCED
on the same level of the query - There is a fixed list of variables to project i.e. not
SELECT *
ORDER BY
conditions 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 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.
-
Field Summary
Fields inherited from class org.apache.jena.sparql.algebra.TransformCopy
COPY_ALWAYS, COPY_ONLY_ON_CHANGE
-
Constructor Summary
-
Method Summary
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, transform
-
Constructor Details
-
TransformOrderByDistinctApplication
public TransformOrderByDistinctApplication()
-
-
Method Details
-
transform
- Specified by:
transform
in interfaceTransform
- Overrides:
transform
in classTransformCopy
-
transform
- Specified by:
transform
in interfaceTransform
- Overrides:
transform
in classTransformCopy
-