docs: protected PlanNode attachSorting( QueryContext context,
                                        PlanNode plan,
                                        List<? extends Ordering> orderings ) {
          if (orderings.isEmpty()) return plan;
          // remove all duplicates
          orderings = orderings.stream().distinct().collect(Collectors.toList());
          PlanNode sortNode = new PlanNode(Type.SORT);
  
          context.getHints().hasSort = true;
          sortNode.setProperty(Property.SORT_ORDER_BY, orderings);
          for (Ordering ordering : orderings) {
              sortNode.addSelectors(Visitors.getSelectorsReferencedBy(ordering));
          }
  
          sortNode.addLastChild(plan);
          return sortNode;
      }