Source:
<code>protected final OperatorFactory createHashProjectOperator(int operatorId, PlanNodeId planNodeId, List<Type> types) { ImmutableMap.Builder<Symbol, Type> symbolTypes = ImmutableMap.builder(); ImmutableList.Builder<VariableReferenceExpression> variables = ImmutableList.builder(); ImmutableMap.Builder<VariableReferenceExpression, Integer> variableToInputMapping = ImmutableMap.builder(); ImmutableList.Builder<PageProjection> projections = ImmutableList.builder(); for (int channel = 0; channel < types.size(); channel++) { VariableReferenceExpression variable = new VariableReferenceExpression("h" + channel, types.get(channel)); symbolTypes.put(new Symbol(variable.getName()), types.get(channel)); variables.add(variable); variableToInputMapping.put(variable, channel); projections.add(new InputPageProjection(channel, types.get(channel))); } <START> Optional<Expression> hashExpression = HashGenerationOptimizer.getHashExpression(ImmutableList.copyOf(variables.build())); <END> verify(hashExpression.isPresent()); Map<NodeRef<Expression>, Type> expressionTypes = getExpressionTypes( session, localQueryRunner.getMetadata(), localQueryRunner.getSqlParser(), TypeProvider.copyOf(symbolTypes.build()), hashExpression.get(), ImmutableList.of(), WarningCollector.NOOP); RowExpression translated = translate(hashExpression.get(), expressionTypes, variableToInputMapping.build(), localQueryRunner.getMetadata().getFunctionManager(), localQueryRunner.getTypeManager(), session, false); PageFunctionCompiler functionCompiler = new PageFunctionCompiler(localQueryRunner.getMetadata(), 0); projections.add(functionCompiler.compileProjection(translated, Optional.empty()).get()); return new FilterAndProjectOperator.FilterAndProjectOperatorFactory( operatorId, planNodeId, () -> new PageProcessor(Optional.empty(), projections.build()), ImmutableList.copyOf(Iterables.concat(types, ImmutableList.of(BIGINT))), getFilterAndProjectMinOutputPageSize(session), getFilterAndProjectMinOutputPageRowCount(session)); }</code><technical_language>nit: Do need do a ImmutableList.copy variables.build()? (Since generates ImmutableList</technical_language>

Target:
protected final OperatorFactory createHashProjectOperator(int operatorId, PlanNodeId planNodeId, List<Type> types) { ImmutableMap.Builder<Symbol, Type> symbolTypes = ImmutableMap.builder(); ImmutableList.Builder<VariableReferenceExpression> variables = ImmutableList.builder(); ImmutableMap.Builder<VariableReferenceExpression, Integer> variableToInputMapping = ImmutableMap.builder(); ImmutableList.Builder<PageProjection> projections = ImmutableList.builder(); for (int channel = 0; channel < types.size(); channel++) { VariableReferenceExpression variable = new VariableReferenceExpression("h" + channel, types.get(channel)); symbolTypes.put(new Symbol(variable.getName()), types.get(channel)); variables.add(variable); variableToInputMapping.put(variable, channel); projections.add(new InputPageProjection(channel, types.get(channel))); } Optional<Expression> hashExpression = HashGenerationOptimizer.getHashExpression(variables.build()); verify(hashExpression.isPresent()); Map<NodeRef<Expression>, Type> expressionTypes = getExpressionTypes( session, localQueryRunner.getMetadata(), localQueryRunner.getSqlParser(), TypeProvider.copyOf(symbolTypes.build()), hashExpression.get(), ImmutableList.of(), WarningCollector.NOOP); RowExpression translated = translate(hashExpression.get(), expressionTypes, variableToInputMapping.build(), localQueryRunner.getMetadata().getFunctionManager(), localQueryRunner.getTypeManager(), session, false); PageFunctionCompiler functionCompiler = new PageFunctionCompiler(localQueryRunner.getMetadata(), 0); projections.add(functionCompiler.compileProjection(translated, Optional.empty()).get()); return new FilterAndProjectOperator.FilterAndProjectOperatorFactory( operatorId, planNodeId, () -> new PageProcessor(Optional.empty(), projections.build()), ImmutableList.copyOf(Iterables.concat(types, ImmutableList.of(BIGINT))), getFilterAndProjectMinOutputPageSize(session), getFilterAndProjectMinOutputPageRowCount(session)); }