presto-main/src/main/java/io/prestosql/sql/planner/iterative/rule/MergeLimitOverProjectWithSort.java/MergeLimitOverProjectWithSort/apply
class MergeLimitOverProjectWithSort:    @Override
    public Result apply(LimitNode parent, Captures captures, Context context)
    {
        ProjectNode project = captures.get(PROJECT);
        SortNode sort = captures.get(SORT);

        return Result.ofPlanNode(
                project.replaceChildren(ImmutableList.of(
                        new TopNNode(
                                parent.getId(),
                                sort.getSource(),
                                parent.getCount(),
                                sort.getOrderingScheme(),
                                parent.isPartial() ? PARTIAL : SINGLE))));
    }