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 E7876200B91 for ; Thu, 29 Sep 2016 17:29:24 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E655A160AE3; Thu, 29 Sep 2016 15:29:24 +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 31ED9160AC1 for ; Thu, 29 Sep 2016 17:29:24 +0200 (CEST) Received: (qmail 5592 invoked by uid 500); 29 Sep 2016 15:29:23 -0000 Mailing-List: contact commits-help@beam.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@beam.incubator.apache.org Delivered-To: mailing list commits@beam.incubator.apache.org Received: (qmail 5583 invoked by uid 99); 29 Sep 2016 15:29:23 -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; Thu, 29 Sep 2016 15:29:23 +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 E38551806A5 for ; Thu, 29 Sep 2016 15:29:22 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -7.019 X-Spam-Level: X-Spam-Status: No, score=-7.019 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] 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 kEBDy7_4uOOo for ; Thu, 29 Sep 2016 15:29:22 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 6CF635FBBD for ; Thu, 29 Sep 2016 15:29:21 +0000 (UTC) Received: (qmail 5550 invoked by uid 99); 29 Sep 2016 15:29:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Sep 2016 15:29:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 6DB952C0057 for ; Thu, 29 Sep 2016 15:29:20 +0000 (UTC) Date: Thu, 29 Sep 2016 15:29:20 +0000 (UTC) From: =?utf-8?Q?Jean-Baptiste_Onofr=C3=A9_=28JIRA=29?= To: commits@beam.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (BEAM-621) Add MapValues and MapKeys functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 29 Sep 2016 15:29:25 -0000 [ https://issues.apache.org/jira/browse/BEAM-621?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D155330= 88#comment-15533088 ]=20 Jean-Baptiste Onofr=C3=A9 commented on BEAM-621: ------------------------------------------- About the same idea, it would be great to have {{MapElements}} working with= POJO. For instance if the {{PCollection}} contains POJO like: {code} class MyPojo implements Serializable { ... public String getName() { ...=C2=A0} public Integer getAge() { ... } } {code} today, to map this POJO to just name, we have to use {{MapElements}} with a= function. It could be interesting to provide a convenient function like {{= MapElements.with("name"))}} that will use reflection to map on {{getName()}= }. > Add MapValues and MapKeys functions > ----------------------------------- > > Key: BEAM-621 > URL: https://issues.apache.org/jira/browse/BEAM-621 > Project: Beam > Issue Type: New Feature > Components: beam-model > Reporter: Jean-Baptiste Onofr=C3=A9 > Assignee: Jean-Baptiste Onofr=C3=A9 > > Currently, we have the {{MapElements}} {{PTransform}} that "convert" a {{= PCollection}} of {{KV}} to another {{PCollection}} (for instance {{String}}= ). > A very classic mapping function is to just have the keys or values of {{K= V}}. > To do it currently, we can use {{MapElements}} or a generic {{ParDo}} (wi= th {{DoFn}}). > It would be helpful and reduce the user code to have {{MapValues}} and {{= MapKeys}}. It would take a {{PCollection}}=C2=A0of {{KV}}: {{MapKeys}} will= map the=C2=A0input {{PCollection}}=C2=A0to a {{PCollection}} of {{K}} and = {{MapValues}} to a {{PCollection}} of {{V}}. -- This message was sent by Atlassian JIRA (v6.3.4#6332)