From dev-return-100763-archive-asf-public=cust-asf.ponee.io@kafka.apache.org Fri Jan 4 20:36:06 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id BFCEE180660 for ; Fri, 4 Jan 2019 20:36:05 +0100 (CET) Received: (qmail 80850 invoked by uid 500); 4 Jan 2019 19:36:04 -0000 Mailing-List: contact dev-help@kafka.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kafka.apache.org Delivered-To: mailing list dev@kafka.apache.org Received: (qmail 80839 invoked by uid 99); 4 Jan 2019 19:36:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Jan 2019 19:36:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 111C1180E10 for ; Fri, 4 Jan 2019 19:36:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 5TBOzbsDoMtT for ; Fri, 4 Jan 2019 19:36:02 +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 119E25FAC6 for ; Fri, 4 Jan 2019 19:36:02 +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 5302EE00CB for ; Fri, 4 Jan 2019 19:36:01 +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 B5B072543C for ; Fri, 4 Jan 2019 19:36:00 +0000 (UTC) Date: Fri, 4 Jan 2019 19:36:00 +0000 (UTC) From: "Boyang Chen (JIRA)" To: dev@kafka.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (KAFKA-4835) Allow users control over repartitioning MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/KAFKA-4835?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Boyang Chen resolved KAFKA-4835. -------------------------------- Resolution: Fixed > Allow users control over repartitioning > --------------------------------------- > > Key: KAFKA-4835 > URL: https://issues.apache.org/jira/browse/KAFKA-4835 > Project: Kafka > Issue Type: Sub-task > Components: streams > Affects Versions: 0.10.2.0 > Reporter: Michal Borowiecki > Priority: Major > Labels: needs-kip > > From https://issues.apache.org/jira/browse/KAFKA-4601?focusedCommentId=15881030&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15881030 > ...it would be good to provide users more control over the repartitioning. > My use case is as follows (unrelated bits omitted for brevity): > {code} > KTable loggedInCustomers = builder > .stream("customerLogins") > .groupBy((key, activity) -> > activity.getCustomerRef()) > .reduce((first,second) -> second, loginStore()); > > builder > .stream("balanceUpdates") > .map((key, activity) -> new KeyValue<>( > activity.getCustomerRef(), > activity)) > .join(loggedInCustomers, (activity, session) -> ... > .to("sessions"); > {code} > Both "groupBy" and "map" in the underlying implementation set the repartitionRequired flag (since the key changes), and the aggregation/join that follows will create the repartitioned topic. > However, in our case I know that both input streams are already partitioned by the customerRef value, which I'm mapping into the key (because it's required by the join operation). > So there are 2 unnecessary intermediate topics created with their associated overhead, while the ultimate goal is simply to do a join on a value that we already use to partition the original streams anyway. > (Note, we don't have the option to re-implement the original input streams to make customerRef the message key.) > I think it would be better to allow the user to decide (from their knowledge of the incoming streams) whether a repartition is mandatory on aggregation and join operations (overloaded version of the methods with the repartitionRequired flag exposed maybe?) > An alternative would be to allow users to perform a join on a value other than the key (a keyValueMapper parameter to join, like the one used for joins with global tables), but I expect that to be more involved and error-prone to use for people who don't understand the partitioning requirements well (whereas it's safe for global tables). -- This message was sent by Atlassian JIRA (v7.6.3#76005)