Source:
<code>private static PlanNode addPartitioningNodes(Context context, FunctionManager functionManager, PlanNode node, VariableReferenceExpression partitionVariable, KdbTree kdbTree, RowExpression geometry, Optional<RowExpression> radius) { Assignments.Builder projections = Assignments.builder(); for (VariableReferenceExpression outputVariable : node.getOutputVariables()) { projections.put(outputVariable, outputVariable); } FunctionHandle castFunctionHandle = functionManager.lookupCast(CAST, VARCHAR.getTypeSignature(), KDB_TREE.getTypeSignature()); <START> ImmutableList.Builder<RowExpression> partitioningArgumentsBuilder = ImmutableList.<RowExpression>builder() <END> .add(new CallExpression(CAST.name(), castFunctionHandle, KDB_TREE, ImmutableList.of(new ConstantExpression(utf8Slice(KdbTreeUtils.toJson(kdbTree)), VARCHAR)))) .add(geometry); radius.map(partitioningArgumentsBuilder::add); ImmutableList<RowExpression> partitioningArguments = partitioningArgumentsBuilder.build(); QualifiedName spatialPartitions = QualifiedName.of("spatial_partitions"); FunctionHandle functionHandle = functionManager.lookupFunction( spatialPartitions.toString(), fromTypes(partitioningArguments.stream() .map(RowExpression::getType).collect(toImmutableList()))); CallExpression partitioningFunction = new CallExpression(spatialPartitions.toString(), functionHandle, new ArrayType(INTEGER), partitioningArguments); VariableReferenceExpression partitionsVariable = context.getVariableAllocator().newVariable(partitioningFunction); projections.put(partitionsVariable, partitioningFunction); return new UnnestNode( context.getIdAllocator().getNextId(), new ProjectNode(context.getIdAllocator().getNextId(), node, projections.build()), node.getOutputVariables(), ImmutableMap.of(partitionsVariable, ImmutableList.of(partitionVariable)), Optional.empty()); }</code><technical_language><RowExpression> is redundant for builder()</technical_language>

Target:
private static PlanNode addPartitioningNodes(Context context, FunctionManager functionManager, PlanNode node, VariableReferenceExpression partitionVariable, KdbTree kdbTree, RowExpression geometry, Optional<RowExpression> radius) { Assignments.Builder projections = Assignments.builder(); for (VariableReferenceExpression outputVariable : node.getOutputVariables()) { projections.put(outputVariable, outputVariable); } FunctionHandle castFunctionHandle = functionManager.lookupCast(CAST, VARCHAR.getTypeSignature(), KDB_TREE.getTypeSignature()); ImmutableList.Builder partitioningArgumentsBuilder = ImmutableList.builder() .add(new CallExpression(CAST.name(), castFunctionHandle, KDB_TREE, ImmutableList.of(Expressions.constant(utf8Slice(KdbTreeUtils.toJson(kdbTree)), VARCHAR)))) .add(geometry); radius.map(partitioningArgumentsBuilder::add); List<RowExpression> partitioningArguments = partitioningArgumentsBuilder.build(); String spatialPartitionsFunctionName = "spatial_partitions"; FunctionHandle functionHandle = functionManager.lookupFunction( spatialPartitionsFunctionName, fromTypes(partitioningArguments.stream() .map(RowExpression::getType).collect(toImmutableList()))); CallExpression partitioningFunction = new CallExpression(spatialPartitionsFunctionName, functionHandle, new ArrayType(INTEGER), partitioningArguments); VariableReferenceExpression partitionsVariable = context.getVariableAllocator().newVariable(partitioningFunction); projections.put(partitionsVariable, partitioningFunction); return new UnnestNode( context.getIdAllocator().getNextId(), new ProjectNode(context.getIdAllocator().getNextId(), node, projections.build()), node.getOutputVariables(), ImmutableMap.of(partitionsVariable, ImmutableList.of(partitionVariable)), Optional.empty()); }