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 C9FFA200D04 for ; Mon, 11 Sep 2017 19:32:42 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C86DB1609C4; Mon, 11 Sep 2017 17:32:42 +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 418DB1609B7 for ; Mon, 11 Sep 2017 19:32:42 +0200 (CEST) Received: (qmail 59679 invoked by uid 500); 11 Sep 2017 17:32:36 -0000 Mailing-List: contact user-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list user@flink.apache.org Received: (qmail 59670 invoked by uid 99); 11 Sep 2017 17:32:36 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Sep 2017 17:32:36 +0000 Received: from [192.168.2.104] (p57A8B382.dip0.t-ipconnect.de [87.168.179.130]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id B6D341A0048 for ; Mon, 11 Sep 2017 17:32:35 +0000 (UTC) Subject: Re: Best way to deriving streams from another one To: user@flink.apache.org References: <1505074518950-0.post@n4.nabble.com> From: Chesnay Schepler Message-ID: <9fe0ed98-7457-49ff-c026-6ce03914781e@apache.org> Date: Mon, 11 Sep 2017 19:32:36 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1505074518950-0.post@n4.nabble.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US archived-at: Mon, 11 Sep 2017 17:32:43 -0000 Have a look at side outputs in the documentation, they allow you to emit to multiple streams (of different types!) with a ProcessFunction. On 10.09.2017 22:15, AndreaKinn wrote: > Hi, > I have a data stream resulting from an operation executed on a data stream > of data. > Essentially I want to obtain two different streams from that one to send > their to different cassandra tables. > > I.e.: > > datastream 0 composed by Tuple3 > > I want to have: > > a datastream 1 composed by every triple of datastream 0 > where Val2 > X > and > a data stream 2 composed by every couple . > > This lied me to have two datastreams with Tuples of different arity (3 and > 2). > > Currently I have implemented it getting the 0 datastream and then calling > separately a map function to retrieve datastream 2 and a flatmap function to > retrieve datastream 1. So I have two different prepared statement of > Cassandra called on the two different streams. > It works fine. > > However this solutions looks really awful and inefficient, there is a more > elegant alternative? > > I tried also to send towards Cassandra a datastream and > select in the statement just two values (in this way I should use just the > flatmap operator) but during the execution raise an exception on it. > > > > -- > Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/ >