[ https://issues.apache.org/jira/browse/KAFKA-6871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16466103#comment-16466103 ]
ASF GitHub Bot commented on KAFKA-6871: --------------------------------------- mjsax closed pull request #4971: KAFKA-6871: KStreams Scala API: incorrect Javadocs and misleading parameter name URL: https://github.com/apache/kafka/pull/4971 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KStream.scala b/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KStream.scala index d3ccaecb777..7634b95bb1d 100644 --- a/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KStream.scala +++ b/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KStream.scala @@ -261,30 +261,30 @@ class KStream[K, V](val inner: KStreamJ[K, V]) { /** * Transform each record of the input stream into zero or more records in the output stream (both key and value type * can be altered arbitrarily). - * A `Transformer` (provided by the given `TransformerSupplier`) is applied to each input record and - * computes zero or more output records. In order to assign a state, the state must be created and registered - * beforehand via stores added via `addStateStore` or `addGlobalStore` before they can be connected to the `Transformer` + * A `Transformer` is applied to each input record and computes zero or more output records. In order to assign a + * state, the state must be created and registered beforehand via stores added via `addStateStore` or `addGlobalStore` + * before they can be connected to the `Transformer` * - * @param transformerSupplier a instance of `TransformerSupplier` that generates a `Transformer` + * @param transformer the `Transformer` instance * @param stateStoreNames the names of the state stores used by the processor * @return a [[KStream]] that contains more or less records with new key and value (possibly of different type) * @see `org.apache.kafka.streams.kstream.KStream#transform` */ - def transform[K1, V1](transformerSupplier: Transformer[K, V, (K1, V1)], + def transform[K1, V1](transformer: Transformer[K, V, (K1, V1)], stateStoreNames: String*): KStream[K1, V1] = { val transformerSupplierJ: TransformerSupplier[K, V, KeyValue[K1, V1]] = new TransformerSupplier[K, V, KeyValue[K1, V1]] { override def get(): Transformer[K, V, KeyValue[K1, V1]] = { new Transformer[K, V, KeyValue[K1, V1]] { override def transform(key: K, value: V): KeyValue[K1, V1] = { - transformerSupplier.transform(key, value) match { + transformer.transform(key, value) match { case (k1, v1) => KeyValue.pair(k1, v1) case _ => null } } - override def init(context: ProcessorContext): Unit = transformerSupplier.init(context) + override def init(context: ProcessorContext): Unit = transformer.init(context) - override def close(): Unit = transformerSupplier.close() + override def close(): Unit = transformer.close() } } } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > KStreams Scala API: incorrect Javadocs and misleading parameter name > -------------------------------------------------------------------- > > Key: KAFKA-6871 > URL: https://issues.apache.org/jira/browse/KAFKA-6871 > Project: Kafka > Issue Type: Bug > Affects Versions: 2.0.0 > Reporter: Michael Noll > Priority: Minor > > The single parameter for function > {code:java} > def transform[K1, V1](transformerSupplier: Transformer[K, V, (K1, V1)], > stateStoreNames: String*): KStream[K1, V1]{code} > is a {{Transformer}}, not a {{TransformerSupplier}}. > The parameter should be renamed and the javadocs should be updated, too. > [https://github.com/apache/kafka/blob/trunk/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KStream.scala] -- This message was sent by Atlassian JIRA (v7.6.3#76005)