class MoveOrderBeneathRename implements Rule<Order> {

    private final Capture<Rename> renameCapture;
    private final Pattern<Order> pattern;

    public MoveOrderBeneathRename() {
        this.renameCapture = new Capture<>();
        this.pattern = typeOf(Order.class)
            .with(source(), typeOf(Rename.class).capturedAs(renameCapture));
    }

    @Override
    public Pattern<Order> pattern() {
        return pattern;
    }

    @Override
    public LogicalPlan apply(Order plan,
                             Captures captures,
                             PlanStats planStats,
                             TransactionContext txnCtx,
                             NodeContext nodeCtx,
                             UnaryOperator<LogicalPlan> resolvePlan) {<FILL_FUNCTION_BODY>}
}

        Rename rename = captures.get(renameCapture);
        Function<? super Symbol, ? extends Symbol> mapField = FieldReplacer.bind(rename::resolveField);
        OrderBy mappedOrderBy = plan.orderBy().map(mapField);
        if (rename.source().outputs().containsAll(mappedOrderBy.orderBySymbols())) {
            Order newOrder = new Order(rename.source(), mappedOrderBy);
            return rename.replaceSources(List.of(newOrder));
        } else {
            return null;
        }
    
<no_super_class>