public static String printDistributedFromFragments(List<PlanFragment> allFragments, FunctionAndTypeManager functionAndTypeManager, Session session)
    {
        PlanNodeIdGenerator idGenerator = new PlanNodeIdGenerator();
        Map<PlanFragmentId, PlanFragment> fragmentsById = Maps.uniqueIndex(allFragments, PlanFragment::getId);

        StringBuilder output = new StringBuilder();
        output.append("digraph distributed_plan {\n");

        for (PlanFragment planFragment : allFragments) {
            printFragmentNodes(output, planFragment, idGenerator, functionAndTypeManager, session);
            planFragment.getRoot().accept(new EdgePrinter(output, fragmentsById, idGenerator), null);
        }

        output.append("}\n");
        return output.toString();
    }
@Test
    public void testPrintDistributedFromFragments()
    {
        List<PlanFragment> allFragments = new ArrayList<>();
        allFragments.add(createTestPlanFragment(0, TEST_TABLE_SCAN_NODE));
        allFragments.add(createTestPlanFragment(1, TEST_TABLE_SCAN_NODE));
        String actual = printDistributedFromFragments(
                allFragments,
                FUNCTION_AND_TYPE_MANAGER,
                testSessionBuilder().build());
        String expected = "digraph distributed_plan {\n" +
                "subgraph cluster_0 {\n" +
                "label = \"SOURCE\"\n" +
                "plannode_1[label=\"{TableScan | [TableHandle \\{connectorId='connector_id', connectorHandle='com.facebook.presto.testing.TestingMetadata$TestingTableHandle@1af56f7', layout='Optional.empty'\\}]|Estimates: \\{rows: ? (0B), cpu: ?, memory: ?, network: ?\\}\n" +
                "}\", style=\"rounded, filled\", shape=record, fillcolor=deepskyblue];\n" +
                "}\n" +
                "subgraph cluster_1 {\n" +
                "label = \"SOURCE\"\n" +
                "plannode_1[label=\"{TableScan | [TableHandle \\{connectorId='connector_id', connectorHandle='com.facebook.presto.testing.TestingMetadata$TestingTableHandle@1af56f7', layout='Optional.empty'\\}]|Estimates: \\{rows: ? (0B), cpu: ?, memory: ?, network: ?\\}\n" +
                "}\", style=\"rounded, filled\", shape=record, fillcolor=deepskyblue];\n" +
                "}\n" +
                "}\n";
        assertEquals(actual, expected);
    }