public void reset() {
    close();
    visitorStack.clear();
    ancestorStack.clear();
    nextMatchedNode = null;
    firstAncestorOfTraceback = -1;
    initStack();
  }
This method must be invoked before iteration
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/tree/AbstractTreeVisitor.java