Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-1502

Chained has()-steps should simply left-append HasContainers in Gremlin-Java.

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.2.2
    • Fix Version/s: 3.2.4
    • Component/s: process
    • Labels:
      None

      Description

      In Gremlin-Java, g.V().has(a).has(b).has(c).out() is originally represented as [GraphStep,HasStep(a),HasStep(b),HasStep(c),VertexStep]. Ultimately, InlineFilterStrategy or most provider strategies will turn such HasStep-chains into [GraphStep,HasStep(a,b,c),VertexStep]. That is, strategies fold has()-steps "left" and delete "right" has()-steps and left propagates their labels (i.e. clock cycles). I think that GraphTraversal should simply do this:

      public GraphTraversal has(whateves) {
        if(this.getEndStep() instanceof HasStep)
          this.getEndSte().addHasContainer(new HasContainer(whateves))
        else
          this.addStep(new HasStep(new HasContainer(whateves)));
        this.bytecode.addStep("has",whateves);
        return this;
      }
      

      In essence, a "write time" optimization can be done. Given that chains of has()'s is super common, this can save significant clock-cycles in the long run of a production application.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                okram Marko A. Rodriguez
                Reporter:
                okram Marko A. Rodriguez
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: