presto-main/src/main/java/io/prestosql/cost/StatsAndCosts.java/StatsAndCosts/reconstructStatsAndCosts
class StatsAndCosts:    private static void reconstructStatsAndCosts(
            StageInfo stage,
            ImmutableMap.Builder<PlanNodeId, PlanNodeStatsEstimate> planNodeStats,
            ImmutableMap.Builder<PlanNodeId, PlanCostEstimate> planNodeCosts)
    {
        PlanFragment planFragment = stage.getPlan();
        if (planFragment != null) {
            planNodeStats.putAll(planFragment.getStatsAndCosts().getStats());
            planNodeCosts.putAll(planFragment.getStatsAndCosts().getCosts());
        }
        for (StageInfo subStage : stage.getSubStages()) {
            reconstructStatsAndCosts(subStage, planNodeStats, planNodeCosts);
        }
    }