presto-main/src/main/java/io/prestosql/sql/planner/sanity/VerifyOnlyOneOutputNode.java/VerifyOnlyOneOutputNode/validate
class VerifyOnlyOneOutputNode:    @Override
    public void validate(PlanNode plan, Session session, Metadata metadata, TypeAnalyzer typeAnalyzer, TypeProvider types, WarningCollector warningCollector)
    {
        int outputPlanNodesCount = searchFrom(plan)
                .where(OutputNode.class::isInstance)
                .findAll()
                .size();
        checkState(outputPlanNodesCount == 1, "Expected plan to have single instance of OutputNode");
    }