Package org.apache.tinkerpop.gremlin.gql
Interface GqlExecutor
- All Known Implementing Classes:
DefaultGqlExecutor
public interface GqlExecutor
Executes a
GqlMatchPlan against a graph and returns a lazy iterator of GqlRow
result rows. DefaultGqlExecutor is the reference implementation.
When to implement this interface
This is the primary customization point for providers with a native query or traversal
engine. Such a provider can keep DefaultGqlPlanner, getting GQL MATCH parsing and
cardinality-guided join ordering for free, and replace only the executor to translate the
GqlMatchPlan into native operations.
The contract for implementors:
- Iterate seed vertex candidates matching the plan's seed label and predicates.
- For each seed, extend the partial match through the plan's
extension stepsin an order that keeps every step's anchor variable bound before that step executes. - Emit one
GqlRowper complete match, built withGqlRow.of(org.apache.tinkerpop.gremlin.structure.Element[], java.util.Map<java.lang.Integer, java.util.List<org.apache.tinkerpop.gremlin.structure.Edge>>)and populated as described onGqlRow. - Return results lazily rather than materialising the full result set in memory.
- Honor thread interruption while iterating by throwing
TraversalInterruptedException, so that a traversal timeout can stop a long-running match. - If the iterator holds provider resources, return a
CloseableIteratorthat releases them onclose().GqlMatchStepcloses the iterator when it moves on to the next incoming traverser, when the step is reset, and when the top-level traversal holding the step is closed, including when it finishes early because of a downstreamlimit(). Amatch()nested in a child traversal is not closed by the top-levelclose(); likeGraphStep, it relies on its parent resetting the child traversal.
-
Method Summary
-
Method Details
-
execute
Executes the plan with no parameter bindings.- Parameters:
plan- the compiled execution plan- Returns:
- a lazy iterator of result rows
-
execute
Executes the plan with the given parameter bindings.- Parameters:
plan- the compiled execution planparams- parameter bindings for$namereferences in property predicates; may be empty if the query contains no parameter references- Returns:
- a lazy iterator of result rows
-