[jira] [Commented] (KAFKA-4217) KStream.transform equivalent of flatMap
[ https://issues.apache.org/jira/browse/KAFKA-4217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15606502#comment-15606502 ] Guozhang Wang commented on KAFKA-4217: -- For now a suggested workaround would be {{stream.transform(...).flatMap((k, v) -> v)}}. > KStream.transform equivalent of flatMap > --- > > Key: KAFKA-4217 > URL: https://issues.apache.org/jira/browse/KAFKA-4217 > Project: Kafka > Issue Type: Improvement > Components: streams >Affects Versions: 0.10.0.1 >Reporter: Elias Levy >Assignee: Guozhang Wang > > {{KStream.transform}} gives you access to state stores while allowing you to > return zero or one transformed {{KeyValue}}. Alas, it is unclear what method > you should use if you want to access state stores and return zero or multiple > {{KeyValue}}. Presumably you can use {{transform}}, always return {{null}}, > and use {{ProcessorContext.forward}} to emit {{KeyValues}}. > It may be good to introduce a {{transform}}-like {{flatMap}} equivalent, or > allow store access from other {{KStream}} methods, such as {{flatMap}} itself. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (KAFKA-4217) KStream.transform equivalent of flatMap
[ https://issues.apache.org/jira/browse/KAFKA-4217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15560348#comment-15560348 ] Guozhang Wang commented on KAFKA-4217: -- We designed {{process()}} to be differentiated from {{transform()}} such that {{process}} is used as the "end point" of the topology, returning no new data, whereas {{transform}} used as connection point of the topology. I think it is reasonable to extend {{Transformer.transform}} and {{Transformer.punctuate}} to return a list of {{R}} typed values. > KStream.transform equivalent of flatMap > --- > > Key: KAFKA-4217 > URL: https://issues.apache.org/jira/browse/KAFKA-4217 > Project: Kafka > Issue Type: Improvement > Components: streams >Affects Versions: 0.10.0.1 >Reporter: Elias Levy >Assignee: Guozhang Wang > > {{KStream.transform}} gives you access to state stores while allowing you to > return zero or one transformed {{KeyValue}}. Alas, it is unclear what method > you should use if you want to access state stores and return zero or multiple > {{KeyValue}}. Presumably you can use {{transform}}, always return {{null}}, > and use {{ProcessorContext.forward}} to emit {{KeyValues}}. > It may be good to introduce a {{transform}}-like {{flatMap}} equivalent, or > allow store access from other {{KStream}} methods, such as {{flatMap}} itself. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (KAFKA-4217) KStream.transform equivalent of flatMap
[ https://issues.apache.org/jira/browse/KAFKA-4217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15556371#comment-15556371 ] Elias Levy commented on KAFKA-4217: --- That would work as well. > KStream.transform equivalent of flatMap > --- > > Key: KAFKA-4217 > URL: https://issues.apache.org/jira/browse/KAFKA-4217 > Project: Kafka > Issue Type: Improvement > Components: streams >Affects Versions: 0.10.0.1 >Reporter: Elias Levy >Assignee: Guozhang Wang > > {{KStream.transform}} gives you access to state stores while allowing you to > return zero or one transformed {{KeyValue}}. Alas, it is unclear what method > you should use if you want to access state stores and return zero or multiple > {{KeyValue}}. Presumably you can use {{transform}}, always return {{null}}, > and use {{ProcessorContext.forward}} to emit {{KeyValues}}. > It may be good to introduce a {{transform}}-like {{flatMap}} equivalent, or > allow store access from other {{KStream}} methods, such as {{flatMap}} itself. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (KAFKA-4217) KStream.transform equivalent of flatMap
[ https://issues.apache.org/jira/browse/KAFKA-4217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15556349#comment-15556349 ] Matthias J. Sax commented on KAFKA-4217: Would it not be simpler to change `process(...)` to return a `KStream` instead of `void` ? > KStream.transform equivalent of flatMap > --- > > Key: KAFKA-4217 > URL: https://issues.apache.org/jira/browse/KAFKA-4217 > Project: Kafka > Issue Type: Improvement > Components: streams >Affects Versions: 0.10.0.1 >Reporter: Elias Levy >Assignee: Guozhang Wang > > {{KStream.transform}} gives you access to state stores while allowing you to > return zero or one transformed {{KeyValue}}. Alas, it is unclear what method > you should use if you want to access state stores and return zero or multiple > {{KeyValue}}. Presumably you can use {{transform}}, always return {{null}}, > and use {{ProcessorContext.forward}} to emit {{KeyValues}}. > It may be good to introduce a {{transform}}-like {{flatMap}} equivalent, or > allow store access from other {{KStream}} methods, such as {{flatMap}} itself. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (KAFKA-4217) KStream.transform equivalent of flatMap
[ https://issues.apache.org/jira/browse/KAFKA-4217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=1654#comment-1654 ] Elias Levy commented on KAFKA-4217: --- It would seem to be the same request: allow a transform that emits multiple values. Like Fodor, I am using {{ProcessorContext.forward}} to emit multiple values from {{Transformer.transform}}. Unlike him, I return {{null}} from the method instead of returning dummy values that must be filtered. At the very least, it should be documented that one can use {{ProcessorContext.forward}} to emit multiple values from {{Transformer.transform}}. Ideally, {{Transformer.transform}} would be modified to allow returning multiple values, or a variant of {{Transformer}} would allow you to do so. > KStream.transform equivalent of flatMap > --- > > Key: KAFKA-4217 > URL: https://issues.apache.org/jira/browse/KAFKA-4217 > Project: Kafka > Issue Type: Improvement > Components: streams >Affects Versions: 0.10.0.1 >Reporter: Elias Levy >Assignee: Guozhang Wang > > {{KStream.transform}} gives you access to state stores while allowing you to > return zero or one transformed {{KeyValue}}. Alas, it is unclear what method > you should use if you want to access state stores and return zero or multiple > {{KeyValue}}. Presumably you can use {{transform}}, always return {{null}}, > and use {{ProcessorContext.forward}} to emit {{KeyValues}}. > It may be good to introduce a {{transform}}-like {{flatMap}} equivalent, or > allow store access from other {{KStream}} methods, such as {{flatMap}} itself. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (KAFKA-4217) KStream.transform equivalent of flatMap
[ https://issues.apache.org/jira/browse/KAFKA-4217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15534404#comment-15534404 ] Guozhang Wang commented on KAFKA-4217: -- Is this related to https://issues.apache.org/jira/browse/KAFKA-3543? In other words if https://issues.apache.org/jira/browse/KAFKA-3543 is added do you still need this request? > KStream.transform equivalent of flatMap > --- > > Key: KAFKA-4217 > URL: https://issues.apache.org/jira/browse/KAFKA-4217 > Project: Kafka > Issue Type: Improvement > Components: streams >Affects Versions: 0.10.0.1 >Reporter: Elias Levy >Assignee: Guozhang Wang > > {{KStream.transform}} gives you access to state stores while allowing you to > return zero or one transformed {{KeyValue}}. Alas, it is unclear what method > you should use if you want to access state stores and return zero or multiple > {{KeyValue}}. Presumably you can use {{transform}}, always return {{null}}, > and use {{ProcessorContext.forward}} to emit {{KeyValues}}. > It may be good to introduce a {{transform}}-like {{flatMap}} equivalent, or > allow store access from other {{KStream}} methods, such as {{flatMap}} itself. -- This message was sent by Atlassian JIRA (v6.3.4#6332)