@Override
    public void validate(PlanNode plan, Session session, Metadata metadata, SqlParser sqlParser, 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");
    }
@Test
    public void testValidateSuccessful()
    {
        // random seemingly valid plan
        PlanNode root =
                new OutputNode(
                        Optional.empty(),
                        idAllocator.getNextId(),
                        new ProjectNode(
                                idAllocator.getNextId(),
                                new ValuesNode(
                                        Optional.empty(),
                                        idAllocator.getNextId(),
                                        ImmutableList.of(), ImmutableList.of(),
                                        Optional.empty()),
                                Assignments.of()
                        ), ImmutableList.of(), ImmutableList.of());
        new VerifyOnlyOneOutputNode().validate(root, null, null, null, null, WarningCollector.NOOP);
    }