code: public boolean orderByHasSelectOneStepAndForLabelNotInTree() {
          Set<String> labels = new HashSet<>();
          for (ReplacedStep<?, ?> replacedStep : linearPathToLeafNode()) {
              for (String label : labels) {
                  labels.add(SqlgUtil.originalLabel(label));
              }
              for (Pair<Traversal.Admin<?, ?>, Comparator<?>> objects : replacedStep.getSqlgComparatorHolder().getComparators()) {
                  Traversal.Admin<?, ?> traversal = objects.getValue0();
                  if (traversal.getSteps().size() == 1 && traversal.getSteps().get(0) instanceof SelectOneStep) {
                      //xxxxx.select("a").order().by(select("a").by("name"), Order.decr)
                      SelectOneStep selectOneStep = (SelectOneStep) traversal.getSteps().get(0);
                      Preconditions.checkState(selectOneStep.getScopeKeys().size() == 1, "toOrderByClause expects the selectOneStep to have one scopeKey!");
                      Preconditions.checkState(selectOneStep.getLocalChildren().size() == 1, "toOrderByClause expects the selectOneStep to have one traversal!");
                      Preconditions.checkState(
                              selectOneStep.getLocalChildren().get(0) instanceof ElementValueTraversal ||
                                      selectOneStep.getLocalChildren().get(0) instanceof TokenTraversal
                              ,
                              "toOrderByClause expects the selectOneStep's traversal to be a ElementValueTraversal or a TokenTraversal!");
                      String selectKey = (String) selectOneStep.getScopeKeys().iterator().next();
                      if (!labels.contains(selectKey)) {
                          return true;
                      }
                  }
              }
          }
          return false;
      }
docs: This happens when a SqlgVertexStep has a SelectOne step where the label is for an element on the path
  that is before the current optimized steps.
  @return