Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C5589200CFE for ; Thu, 24 Aug 2017 23:03:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C3E4716B973; Thu, 24 Aug 2017 21:03:07 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1E5F416B975 for ; Thu, 24 Aug 2017 23:03:06 +0200 (CEST) Received: (qmail 87088 invoked by uid 500); 24 Aug 2017 21:03:04 -0000 Mailing-List: contact jira-help@kafka.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jira@kafka.apache.org Delivered-To: mailing list jira@kafka.apache.org Received: (qmail 87077 invoked by uid 99); 24 Aug 2017 21:03:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Aug 2017 21:03:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 3F8C3C5BF4 for ; Thu, 24 Aug 2017 21:03:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 7MqM85Gk_iRo for ; Thu, 24 Aug 2017 21:03:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 34C515F5B3 for ; Thu, 24 Aug 2017 21:03:03 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 45E91E0E22 for ; Thu, 24 Aug 2017 21:03:02 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 9C14D2538B for ; Thu, 24 Aug 2017 21:03:01 +0000 (UTC) Date: Thu, 24 Aug 2017 21:03:01 +0000 (UTC) From: "Matthias J. Sax (JIRA)" To: jira@kafka.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (KAFKA-4217) KStream.transform equivalent of flatMap MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 24 Aug 2017 21:03:07 -0000 [ https://issues.apache.org/jira/browse/KAFKA-4217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16140694#comment-16140694 ] Matthias J. Sax commented on KAFKA-4217: ---------------------------------------- [~minfing] I guess this is TBD and should be part of a KIP discussion. However, I am not sure if we should add something like this in the first place. The current JavaDocs of {{Transformer}} do explain how to use it already: {noformat} /** * Transform the record with the given key and value. * Additionally, any {@link StateStore state} that is {@link KStream#transform(TransformerSupplier, String...) * attached} to this operator can be accessed and modified * arbitrarily (cf. {@link ProcessorContext#getStateStore(String)}). *

* If more than one output record should be forwarded downstream {@link ProcessorContext#forward(Object, Object)}, * {@link ProcessorContext#forward(Object, Object, int)}, and * {@link ProcessorContext#forward(Object, Object, String)} can be used. * If not record should be forwarded downstream, {@code transform} can return {@code null}. * * @param key the key for the record * @param value the value for the record * @return new {@link KeyValue} pair—if {@code null} no key-value pair will * be forwarded to down stream */ R transform(final K key, final V value); {noformat} IMHO, we can just close this issue as "not an issue". [~elevy] [~guozhang] WDYT? > 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 > Labels: api, needs-kip, newbie > > {{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.4.14#64029)