public PlanNode plan(Analysis analysis)
    {
        return planStatement(analysis, analysis.getStatement());
    }
@Test
    public void testRemoveSingleRowSort()
    {
        Session exploitConstraints = Session.builder(this.getQueryRunner().getDefaultSession())
                .setSystemProperty(EXPLOIT_CONSTRAINTS, Boolean.toString(true))
                .build();

        String query = "SELECT count(*) FROM orders ORDER BY 1";
        assertFalse(
                searchFrom(plan(query, OPTIMIZED, exploitConstraints).getRoot())
                        .where(isInstanceOfAny(SortNode.class))
                        .matches(),
                format("Unexpected sort node for query: '%s'", query));

        assertPlan(
                "SELECT orderkey, count(*) FROM orders GROUP BY orderkey ORDER BY 1",
                anyTree(
                        node(SortNode.class,
                                anyTree(
                                        tableScan("orders")))));
    }