presto-main/src/main/java/io/prestosql/sql/planner/iterative/rule/RemoveRedundantLimit.java/RemoveRedundantLimit/apply
class RemoveRedundantLimit:    @Override
    public Result apply(LimitNode limit, Captures captures, Context context)
    {
        if (limit.getCount() == 0) {
            return Result.ofPlanNode(new ValuesNode(limit.getId(), limit.getOutputSymbols(), ImmutableList.of()));
        }
        if (isAtMost(limit.getSource(), context.getLookup(), limit.getCount())) {
            return Result.ofPlanNode(limit.getSource());
        }
        return Result.empty();
    }