com.bigdata.rdf.sparql.ast.eval
Class AST2BOpContext

java.lang.Object
  extended by com.bigdata.rdf.sparql.ast.eval.AST2BOpContext
All Implemented Interfaces:
IdFactory, IEvaluationContext
Direct Known Subclasses:
AST2BOpUpdateContext

public class AST2BOpContext
extends Object
implements IdFactory, IEvaluationContext

Convenience class for passing around the various pieces of context necessary to construct the bop pipeline.


Field Summary
 int accessPathSampleLimit
          The #of samples to take when comparing the cost of a SCAN with an IN filter to as-bound evaluation for each graph in the data set.
 boolean accessPathScanAndFilter
          For named and default graph access paths where access path cost estimation is disabled by setting the accessPathSampleLimit to ZERO (0), this determines whether a SCAN + FILTER or PARALLEL SUBQUERY (aka as-bound data set join) approach.
 ASTContainer astContainer
          The ASTContainer
protected  AbstractTripleStore db
          The KB instance.
 boolean mergeJoin
          When true, a merge-join pattern will be recognized if it appears in a join group.
 boolean nativeDistinctSolutions
          When true, will use the version of the DISTINCT SOLUTIONS operator which uses the HTree against the native heap.
 boolean nativeDistinctSPO
          When true, may use the version of DISTINCT which operates on the native heap (this is only used when we are doing a hash join against a default graph access path and the predicate for that access path has a large cardinality).
 long nativeDistinctSPOThreshold
          The threshold at which we will use a native hash set rather than a default hash set for a default graph access path.
 boolean nativeHashJoins
          When true, use hash index operations based on the HTree.
 ASTOptimizerList optimizers
          The query optimizers (this includes both query rewrites for correct semantics, such as a rewrite of a DESCRIBE query into a CONSTRUCT query, and query rewrites for performance optimizations).
 QueryEngine queryEngine
          The QueryEngine.
 Properties queryHints
          The query hints from the original #query.
 UUID queryId
          The unique identifier assigned to this query.
 boolean remoteAPs
          When true, force the use of REMOTE access paths in scale-out joins.
 ISparqlCache sparqlCache
          The SparqlCache.
 
Constructor Summary
AST2BOpContext(ASTContainer astContainer, AbstractTripleStore db)
           
 
Method Summary
 String createVar(String prefix)
          Create a new variable name which is unique within the scope of this AST2BOpContext.
 AbstractTripleStore getAbstractTripleStore()
          Return the database.
 String getLexiconNamespace()
          Return the namespace of the LexiconRelation.
 long getLexiconReadTimestamp()
          Return the timestamp which will be used to read on the lexicon.
 String getNamespace()
          Return the namespace of the AbstractTripleStore.
 ISolutionSetStats getSolutionSetStats()
          Some summary statistics about the exogenous solution sets.
 ISparqlCache getSparqlCache()
          Return the cache for named solution sets (experimental feature).
 String getSPONamespace()
          Return the namespace of the SPORelation.
 long getTimestamp()
          The timestamp or transaction identifier associated with the view.
 boolean isCluster()
          Return true if we are running on a cluster.
 boolean isQuads()
          Return true iff the target AbstractTripleStore is in quads mode.
 boolean isSIDs()
          Return true iff the target AbstractTripleStore is in SIDS mode.
 boolean isTriples()
          Return true iff the target AbstractTripleStore is in triples mode.
 int nextId()
           
 void setSolutionSetStats(ISolutionSetStats stats)
          Set the statistics summary for the exogenous solution sets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

astContainer

public final ASTContainer astContainer
The ASTContainer


db

protected final AbstractTripleStore db
The KB instance.


queryEngine

public final QueryEngine queryEngine
The QueryEngine.


sparqlCache

public final ISparqlCache sparqlCache
The SparqlCache.


queryHints

public final Properties queryHints
The query hints from the original #query.

See Also:
QueryHints, ASTQueryHintOptimizer

queryId

public final UUID queryId
The unique identifier assigned to this query.

See Also:
QueryHints.QUERYID, QueryEngine.Annotations#QUERY_ID

optimizers

public final ASTOptimizerList optimizers
The query optimizers (this includes both query rewrites for correct semantics, such as a rewrite of a DESCRIBE query into a CONSTRUCT query, and query rewrites for performance optimizations).


nativeDistinctSPO

public boolean nativeDistinctSPO
When true, may use the version of DISTINCT which operates on the native heap (this is only used when we are doing a hash join against a default graph access path and the predicate for that access path has a large cardinality).


nativeDistinctSPOThreshold

public long nativeDistinctSPOThreshold
The threshold at which we will use a native hash set rather than a default hash set for a default graph access path.


nativeDistinctSolutions

public boolean nativeDistinctSolutions
When true, will use the version of the DISTINCT SOLUTIONS operator which uses the HTree against the native heap.

See Also:
QueryHints.NATIVE_DISTINCT_SOLUTIONS

nativeHashJoins

public boolean nativeHashJoins
When true, use hash index operations based on the HTree. Otherwise use hash index operations based on the Java collection classes. The HTree is more scalable but has higher overhead for small cardinality hash joins.

See Also:
QueryHints.NATIVE_HASH_JOINS

mergeJoin

public boolean mergeJoin
When true, a merge-join pattern will be recognized if it appears in a join group. When false, this can still be selectively enabled using a query hint.


remoteAPs

public boolean remoteAPs
When true, force the use of REMOTE access paths in scale-out joins.


accessPathSampleLimit

public int accessPathSampleLimit
The #of samples to take when comparing the cost of a SCAN with an IN filter to as-bound evaluation for each graph in the data set. The samples are taken from the data set. Each sample is a graph (aka context) in the data set. The range counts and estimated cost to visit the AP for each of the sampled contexts are combined to estimate the total cost of visiting all of the contexts in the NG or DG access path.

When ZERO (0), no cost estimation will be performed and the named graph or default graph join will always use the SCAN + FILTER approach.


accessPathScanAndFilter

public boolean accessPathScanAndFilter
For named and default graph access paths where access path cost estimation is disabled by setting the accessPathSampleLimit to ZERO (0), this determines whether a SCAN + FILTER or PARALLEL SUBQUERY (aka as-bound data set join) approach.

Constructor Detail

AST2BOpContext

public AST2BOpContext(ASTContainer astContainer,
                      AbstractTripleStore db)
Parameters:
queryRoot - The root of the query.
db - The KB instance. TODO We should be passing in the IIndexManager rather than the AbstractTripleStore in order to support cross kb queries. The AST can be annotated with the namespace of the default KB instance, which can then be resolved from the IIndexManager. This would also allow us to clear up the [lex] namespace parameter to the FunctionNode and FunctionRegistry.
Method Detail

getSolutionSetStats

public ISolutionSetStats getSolutionSetStats()
Description copied from interface: IEvaluationContext
Some summary statistics about the exogenous solution sets. These are computed by AST2BOpUtility.convert(AST2BOpContext, IBindingSet[]) before it begins to run the IASTOptimizers.

Specified by:
getSolutionSetStats in interface IEvaluationContext

setSolutionSetStats

public void setSolutionSetStats(ISolutionSetStats stats)
Set the statistics summary for the exogenous solution sets.

Parameters:
stats - The summary statistics.
Throws:
IllegalArgumentException - if the argument is null
IllegalStateException - if the property has already been set.

getTimestamp

public long getTimestamp()
Description copied from interface: IEvaluationContext
The timestamp or transaction identifier associated with the view.

Specified by:
getTimestamp in interface IEvaluationContext

nextId

public int nextId()
Specified by:
nextId in interface IdFactory

isCluster

public boolean isCluster()
Description copied from interface: IEvaluationContext
Return true if we are running on a cluster.

Specified by:
isCluster in interface IEvaluationContext

isQuads

public boolean isQuads()
Description copied from interface: IEvaluationContext
Return true iff the target AbstractTripleStore is in quads mode.

Specified by:
isQuads in interface IEvaluationContext

isSIDs

public boolean isSIDs()
Description copied from interface: IEvaluationContext
Return true iff the target AbstractTripleStore is in SIDS mode.

Specified by:
isSIDs in interface IEvaluationContext

isTriples

public boolean isTriples()
Description copied from interface: IEvaluationContext
Return true iff the target AbstractTripleStore is in triples mode.

Specified by:
isTriples in interface IEvaluationContext

getNamespace

public String getNamespace()
Description copied from interface: IEvaluationContext
Return the namespace of the AbstractTripleStore.

Specified by:
getNamespace in interface IEvaluationContext

getSPONamespace

public String getSPONamespace()
Description copied from interface: IEvaluationContext
Return the namespace of the SPORelation.

Specified by:
getSPONamespace in interface IEvaluationContext

getLexiconNamespace

public String getLexiconNamespace()
Description copied from interface: IEvaluationContext
Return the namespace of the LexiconRelation.

Specified by:
getLexiconNamespace in interface IEvaluationContext

createVar

public final String createVar(String prefix)
Create a new variable name which is unique within the scope of this AST2BOpContext.

Parameters:
prefix - The prefix. The general pattern for a prefix is "-foo-".
Returns:
The unique name.

getLexiconReadTimestamp

public long getLexiconReadTimestamp()
Description copied from interface: IEvaluationContext
Return the timestamp which will be used to read on the lexicon.

Note: This uses the timestamp of the triple store view unless this is a read/write transaction, in which case we need to use the last commit point in order to see any writes which it may have performed (lexicon writes are always unisolated).

Specified by:
getLexiconReadTimestamp in interface IEvaluationContext

getAbstractTripleStore

public AbstractTripleStore getAbstractTripleStore()
Description copied from interface: IEvaluationContext
Return the database.

Specified by:
getAbstractTripleStore in interface IEvaluationContext

getSparqlCache

public ISparqlCache getSparqlCache()
Description copied from interface: IEvaluationContext
Return the cache for named solution sets (experimental feature).

Specified by:
getSparqlCache in interface IEvaluationContext
Returns:
The cache -or- null.
See Also:
QueryHints.SOLUTION_SET_CACHE


Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.