Class ExtensionStep

java.lang.Object
org.apache.tinkerpop.gremlin.gql.ExtensionStep

public final class ExtensionStep extends Object
A single join step in a compiled GqlMatchPlan. An ExtensionStep describes how to extend a partial match by traversing one edge from an already-bound vertex (the anchor) to a new candidate vertex.

The planner emits one ExtensionStep per QueryEdge in the QueryGraph, ordered so that the anchor variable is always bound before the step is executed.

Fields:

  • anchorVariable — the variable name of the already-bound vertex from which traversal begins; never null
  • edgeLabel — optional label constraint on the edge; null means any label is accepted
  • direction — traversal direction relative to the anchor vertex
  • edgeVariable — optional variable name to which the matching edge is bound
  • targetLabel — optional label constraint on the target vertex
  • targetVariable — optional variable name to which the target vertex is bound
  • targetPredicates — property equality predicates on the target vertex, derived from the inline filter map on the corresponding QueryVertex
  • estimatedCost — static selectivity estimate set by the planner; lower values indicate a more selective step that should be tried first when multiple steps are simultaneously eligible. Computed as min(edgeLabelCount, indexedPropertyCount).

At runtime, the executor maintains adaptive counters (recordAttempt() / recordHit()) so that selectivityRatio() reflects observed throughput. The executor uses this ratio — with estimatedCost as a tiebreaker — to choose among simultaneously eligible steps.

  • Constructor Details

  • Method Details

    • getAnchorVariable

      public String getAnchorVariable()
      The variable name of the already-bound vertex used as the starting point for this step.
    • getEdgeLabel

      public String getEdgeLabel()
      The edge label constraint, or null for any label.
    • getDirection

      public Direction getDirection()
      The traversal direction from the anchor vertex.
    • getEdgeVariable

      public String getEdgeVariable()
      The variable name to which the matching edge is bound, or null.
    • getEdgePredicates

      public List<PropertyPredicate> getEdgePredicates()
      Property equality predicates that the traversed edge must satisfy. Empty if no filter was specified on the edge pattern element.
    • getTargetLabel

      public String getTargetLabel()
      The label constraint on the target vertex, or null for any label.
    • getTargetVariable

      public String getTargetVariable()
      The variable name to which the matching target vertex is bound, or null.
    • getTargetPredicates

      public List<PropertyPredicate> getTargetPredicates()
      Property equality predicates that the target vertex must satisfy, derived from the inline filter map on the target QueryVertex. Empty if no filter was specified.
    • getEstimatedCost

      public long getEstimatedCost()
      Static cost estimate set by the planner. Lower values indicate a more selective step. Computed as min(edgeLabelCount, indexedPropertyCount) at plan compile time.
    • toString

      public String toString()
      Overrides:
      toString in class Object