Source:
public static <K> StreamTaskInput<?>[] wrapInputs( AbstractInvokable containingTask, StreamTaskInput<Object>[] inputs, KeySelector<Object, K>[] keySelectors, TypeSerializer<Object>[] inputSerializers, TypeSerializer<K> keySerializer, MemoryManager memoryManager, IOManager ioManager, boolean objectReuse, double managedMemoryFraction, Configuration jobConfiguration) { int keyLength = keySerializer.getLength(); final TypeComparator<Tuple2<byte[], StreamRecord<Object>>> comparator; DataOutputSerializer dataOutputSerializer; if (keyLength > 0) { dataOutputSerializer = new DataOutputSerializer(keyLength); comparator = new FixedLengthByteKeyComparator<>(keyLength); } else { dataOutputSerializer = new DataOutputSerializer(64); comparator = new VariableLengthByteKeyComparator<>(); } int numberOfInputs = inputs.length; CommonContext commonContext = new CommonContext(numberOfInputs); return IntStream.range(0, numberOfInputs) .mapToObj( idx -> { try { KeyAndValueSerializer<Object> keyAndValueSerializer = new KeyAndValueSerializer<>( inputSerializers[idx], keyLength); return new MultiInputSortingDataInput<>( commonContext, inputs[idx], idx, ExternalSorter.newBuilder( memoryManager, containingTask, keyAndValueSerializer, comparator) .memoryFraction(managedMemoryFraction / numberOfInputs) .enableSpilling( ioManager, jobConfiguration.get(AlgorithmOptions.SORT_SPILLING_THRESHOLD)) .maxNumFileHandles( jobConfiguration.get(AlgorithmOptions.SPILLING_MAX_FAN) / numberOfInputs) .objectReuse(objectReuse) .largeRecords(true) .build(), keySelectors[idx], keySerializer, dataOutputSerializer ); } catch (MemoryAllocationException e) { throw new RuntimeException(); } } ).toArray(StreamTaskInput[]::new); }

Target:
public static <K> SelectableSortingInputs wrapInputs( AbstractInvokable containingTask, StreamTaskInput<Object>[] inputs, KeySelector<Object, K>[] keySelectors, TypeSerializer<Object>[] inputSerializers, TypeSerializer<K> keySerializer, MemoryManager memoryManager, IOManager ioManager, boolean objectReuse, double managedMemoryFraction, Configuration jobConfiguration) { int keyLength = keySerializer.getLength(); final TypeComparator<Tuple2<byte[], StreamRecord<Object>>> comparator; DataOutputSerializer dataOutputSerializer; if (keyLength > 0) { dataOutputSerializer = new DataOutputSerializer(keyLength); comparator = new FixedLengthByteKeyComparator<>(keyLength); } else { dataOutputSerializer = new DataOutputSerializer(64); comparator = new VariableLengthByteKeyComparator<>(); } int numberOfInputs = inputs.length; CommonContext commonContext = new CommonContext(numberOfInputs); StreamTaskInput<?>[] sortingInputs = IntStream.range(0, numberOfInputs) .mapToObj( idx -> { try { KeyAndValueSerializer<Object> keyAndValueSerializer = new KeyAndValueSerializer<>( inputSerializers[idx], keyLength); return new MultiInputSortingDataInput<>( commonContext, inputs[idx], idx, ExternalSorter.newBuilder( memoryManager, containingTask, keyAndValueSerializer, comparator) .memoryFraction(managedMemoryFraction / numberOfInputs) .enableSpilling( ioManager, jobConfiguration.get(AlgorithmOptions.SORT_SPILLING_THRESHOLD)) .maxNumFileHandles( jobConfiguration.get(AlgorithmOptions.SPILLING_MAX_FAN) / numberOfInputs) .objectReuse(objectReuse) .largeRecords(true) .build(), keySelectors[idx], keySerializer, dataOutputSerializer ); } catch (MemoryAllocationException e) { throw new RuntimeException(); } } ).toArray(StreamTaskInput[]::new); return new SelectableSortingInputs( sortingInputs, new InputSelector( commonContext, numberOfInputs ) ); }