public IterativePlanFragmenter(
            Plan originalPlan,
            Function<PlanFragmentId, Boolean> isFragmentFinished,
            Metadata metadata,
            PlanChecker planChecker,
            SqlParser sqlParser,
            PlanNodeIdAllocator idAllocator,
            NodePartitioningManager nodePartitioningManager,
            QueryManagerConfig queryManagerConfig,
            Session session,
            WarningCollector warningCollector,
            boolean forceSingleNode)
    {
        this.originalPlan = requireNonNull(originalPlan, "originalPlan is null");
        this.isFragmentFinished = requireNonNull(isFragmentFinished, "isSourceReady is null");
        this.metadata = requireNonNull(metadata, "metadata is null");
        this.planChecker = requireNonNull(planChecker, "planChecker is null");
        this.sqlParser = requireNonNull(sqlParser, "sqlParser is null");
        this.idAllocator = requireNonNull(idAllocator, "idAllocator is null");
        this.variableAllocator = new VariableAllocator(originalPlan.getTypes().allVariables());
        this.nodePartitioningManager = requireNonNull(nodePartitioningManager, "nodePartitioningManager is null");
        this.queryManagerConfig = requireNonNull(queryManagerConfig, "queryManagerConfig is null");
        this.session = requireNonNull(session, "session is null");
        this.warningCollector = requireNonNull(warningCollector, "warningCollector is null");
        this.forceSingleNode = forceSingleNode;
    }
@Test
    public void testIterativePlanFragmenter()
    {
        TableScanNode ts1 = tableScan("ts1", "orderkey");
        TableScanNode ts2 = tableScan("ts2", "orderkey_0");
        PlanNode p1 = project("p1", ts1, variable("orderkey_1", BIGINT), variable("orderkey", BIGINT));
        ExchangeNode remoteExchange1 = systemPartitionedExchange(
                new PlanNodeId("re1"),
                REMOTE_STREAMING,
                p1,
                ImmutableList.of(new VariableReferenceExpression(Optional.empty(), "orderkey_1", BIGINT)),
                Optional.empty());
        ExchangeNode remoteExchange2 = systemPartitionedExchange(
                new PlanNodeId("re2"),
                REMOTE_STREAMING,
                ts2,
                ImmutableList.of(new VariableReferenceExpression(Optional.empty(), "orderkey_0", BIGINT)),
                Optional.empty());
        ExchangeNode localExchange = systemPartitionedExchange(
                new PlanNodeId("le"),
                LOCAL,
                remoteExchange2,
                ImmutableList.of(new VariableReferenceExpression(Optional.empty(), "orderkey_0", BIGINT)),
                Optional.empty());

        JoinNode join = join("join",
                remoteExchange1,
                localExchange,
                JoinDistributionType.PARTITIONED,
                "orderkey_1",
                "orderkey_0");
        Map<String, Type> types = ImmutableMap.of(
                "orderkey", BIGINT,
                "orderkey_1", BIGINT,
                "orderkey_0", BIGINT);
        TypeProvider typeProvider = TypeProvider.copyOf(types);
        Plan plan = new Plan(join, typeProvider, StatsAndCosts.empty());

        SubPlan fullFragmentedPlan = getFullFragmentedPlan(plan);

        inTransaction(session -> runTestIterativePlanFragmenter(join, plan, fullFragmentedPlan, session));
    }