public class ASTDistinctTermScanOptimizer extends Object implements IASTOptimizer
SELECT (DISTINCT|REDUCED) ?property WHERE { ?x ?property ?y . }
and similar patterns using an O(N) algorithm, where N is the number of
distinct solutions.
The main advantage here is to turn an access path that is fully unbound into
a distinct-term scan. If the access path would be evaluated as-bound with at
least one variable bound, then the distinct term scan might not have any
advantage over the pipeline join (and the semantics of DISTINCT would be
violated with multiple as-bound evaluations of the distinct-term-scan without
a hash index to impose the DISTINCT constraint).
TODO We are doing something very similar for GRAPH ?g {}
. It
would be worth while to look at that code in the light of this optimizer.
Constructor and Description |
---|
ASTDistinctTermScanOptimizer() |
Modifier and Type | Method and Description |
---|---|
QueryNodeWithBindingSet |
optimize(AST2BOpContext context,
QueryNodeWithBindingSet input)
Optimize the AST.
|
public QueryNodeWithBindingSet optimize(AST2BOpContext context, QueryNodeWithBindingSet input)
IASTOptimizer
optimize
in interface IASTOptimizer
context
- The evaluation context.input
- The input to the optimizer, consisting of a queryNode and
input binding set.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.