Source:
<code>public <M> OutputStream<M> getOutputStream(OutputDescriptor<M, ?> outputDescriptor) { String streamId = outputDescriptor.getStreamId(); Preconditions.checkState(!outputStreams.containsKey(streamId), "getOutputStream must not be called multiple times with the same streamId: " + streamId); Preconditions.checkState(!outputDescriptors.containsKey(streamId), "getOutputStream must not be called multiple times with the same output descriptor: " + streamId); SystemDescriptor systemDescriptor = outputDescriptor.getSystemDescriptor(); String systemName = systemDescriptor.getSystemName(); checkSystemDescriptorUniqueness(systemDescriptor, systemName); Serde serde = outputDescriptor.getSerde(); KV<Serde, Serde> kvSerdes = getKVSerdes(streamId, serde); if (inputOperators.containsKey(streamId)) { InputOperatorSpec inputOperatorSpec = inputOperators.get(streamId); Serde keySerde = inputOperatorSpec.getKeySerde().orElse(null); Serde valueSerde = inputOperatorSpec.getValueSerde().orElse(null); Preconditions.checkState(kvSerdes.getKey().equals(keySerde) && kvSerdes.getValue().equals(valueSerde), String.format("Stream %s is being used both as an input and an output stream. Serde in Samza happens at " + "stream level, so the same key and message Serde must be used for both.", streamId)); } boolean isKeyed = serde instanceof KVSerde; outputStreams.put(streamId, new OutputStreamImpl<>(streamId, kvSerdes.getKey(), kvSerdes.getValue(), isKeyed)); outputDescriptors.put(streamId, outputDescriptor); <START> systemDescriptors.put(systemDescriptor.getSystemName(), systemDescriptor); <END> return outputStreams.get(streamId); }</code><technical_language>If I mistaken, check condition is not-exist-or-the-same-exist in checkSystemDescriptorUniqueness()? point is if exist, need put systemDescriptor map. change correctness of code, nit. call</technical_language>

Target:
public <M> OutputStream<M> getOutputStream(OutputDescriptor<M, ?> outputDescriptor) { String streamId = outputDescriptor.getStreamId(); Preconditions.checkState(!outputStreams.containsKey(streamId), "getOutputStream must not be called multiple times with the same streamId: " + streamId); Preconditions.checkState(!outputDescriptors.containsKey(streamId), "getOutputStream must not be called multiple times with the same output descriptor: " + streamId); SystemDescriptor systemDescriptor = outputDescriptor.getSystemDescriptor(); String systemName = systemDescriptor.getSystemName(); checkSystemDescriptorUniqueness(systemDescriptor, systemName); Serde serde = outputDescriptor.getSerde(); KV<Serde, Serde> kvSerdes = getKVSerdes(streamId, serde); if (inputOperators.containsKey(streamId)) { InputOperatorSpec inputOperatorSpec = inputOperators.get(streamId); Serde keySerde = inputOperatorSpec.getKeySerde(); Serde valueSerde = inputOperatorSpec.getValueSerde(); Preconditions.checkState(kvSerdes.getKey().equals(keySerde) && kvSerdes.getValue().equals(valueSerde), String.format("Stream %s is being used both as an input and an output stream. Serde in Samza happens at " + "stream level, so the same key and message Serde must be used for both.", streamId)); } boolean isKeyed = serde instanceof KVSerde; outputStreams.put(streamId, new OutputStreamImpl<>(streamId, kvSerdes.getKey(), kvSerdes.getValue(), isKeyed)); outputDescriptors.put(streamId, outputDescriptor); systemDescriptors.put(systemDescriptor.getSystemName(), systemDescriptor); return outputStreams.get(streamId); }