presto-main/src/main/java/io/prestosql/sql/planner/SubqueryPlanner.java/SubqueryPlanner/extractCorrelation
class SubqueryPlanner:    private Map<NodeRef<Expression>, Expression> extractCorrelation(PlanBuilder subPlan, PlanNode subquery)
    {
        Set<NodeRef<Expression>> missingReferences = extractOuterColumnReferences(subquery);
        ImmutableMap.Builder<NodeRef<Expression>, Expression> correlation = ImmutableMap.builder();
        for (NodeRef<Expression> missingReference : missingReferences) {
            // missing reference expression can be solved within current subPlan,
            // or within outer plans in case of multiple nesting levels of subqueries.
            tryResolveMissingExpression(subPlan, missingReference.getNode())
                    .ifPresent(symbolReference -> correlation.put(missingReference, symbolReference));
        }
        return correlation.build();
    }