Source:
<code>public Result apply(ProjectNode node, Captures captures, Context context) { N child = captures.get(targetCapture); Map<DereferenceExpression, VariableReferenceExpression> allDereferencesInProject = getDereferenceSymbolMap(node.getAssignments().getExpressions(), context, metadata, sqlParser); <START> Set<VariableReferenceExpression> childSourceSymbols = child.getSources().stream().map(PlanNode::getOutputVariables).flatMap(Collection::stream).collect(toImmutableSet()); <END> Map<DereferenceExpression, VariableReferenceExpression> pushdownDereferences = allDereferencesInProject.entrySet().stream() .filter(entry -> childSourceSymbols.contains(getBase(entry.getKey(), context.getVariableAllocator().getTypes()))) .collect(toImmutableMap(Map.Entry::getKey, Map.Entry::getValue)); if (pushdownDereferences.isEmpty()) { return Result.empty(); } Result result = pushDownDereferences(context, child, HashBiMap.create(pushdownDereferences)); if (result.isEmpty()) { return Result.empty(); } Assignments.Builder builder = Assignments.builder(); for (Map.Entry<VariableReferenceExpression, RowExpression> entry : node.getAssignments().entrySet()) { if (OriginalExpressionUtils.isExpression(entry.getValue())) { builder.put(entry.getKey(), castToRowExpression(ExpressionTreeRewriter.rewriteWith(new DereferenceReplacer(pushdownDereferences), castToExpression(entry.getValue())))); } else { builder.put(entry.getKey(), entry.getValue()); } } return Result.ofPlanNode(new ProjectNode(context.getIdAllocator().getNextId(), result.getTransformedPlan().get(), builder.build())); }</code><technical_language>formatting Set<VariableReferenceExpression> childSourceSymbols = child.getSources().stream() .map(PlanNode::getOutputVariables).flatMap(Collection::stream) .collect(toImmutableSet());</technical_language>

Target:
public Result apply(ProjectNode node, Captures captures, Context context) { N child = captures.get(targetCapture); Map<DereferenceExpression, VariableReferenceExpression> allDereferencesInProject = getDereferenceSymbolMap(node.getAssignments().getExpressions(), context, metadata, sqlParser); Set<VariableReferenceExpression> childSourceSymbols = child.getSources().stream() .map(PlanNode::getOutputVariables).flatMap(Collection::stream) .collect(toImmutableSet()); Map<DereferenceExpression, VariableReferenceExpression> pushdownDereferences = allDereferencesInProject.entrySet().stream() .filter(entry -> childSourceSymbols.contains(getBase(entry.getKey(), context.getVariableAllocator().getTypes()))) .collect(toImmutableMap(Map.Entry::getKey, Map.Entry::getValue)); if (pushdownDereferences.isEmpty()) { return Result.empty(); } Result result = pushDownDereferences(context, child, HashBiMap.create(pushdownDereferences)); if (result.isEmpty()) { return Result.empty(); } Assignments.Builder builder = Assignments.builder(); for (Map.Entry<VariableReferenceExpression, RowExpression> entry : node.getAssignments().entrySet()) { if (OriginalExpressionUtils.isExpression(entry.getValue())) { builder.put(entry.getKey(), replaceDereferences(entry.getValue(), pushdownDereferences)); } else { builder.put(entry.getKey(), entry.getValue()); } } return Result.ofPlanNode(new ProjectNode(context.getIdAllocator().getNextId(), result.getTransformedPlan().get(), builder.build())); }