Hi Piotr, Thanks for the reply. I was looking for how to create a DataStream under a process function since using that I had to call something else but I came across one of Fabian's posts where he mentioned that this way of creating DS is not "encouraged and tested". So, I figured out an alternate way of using side output and now I can do what I was aiming for.
Thanks, Sid. On Mon, Jan 10, 2022 at 5:29 PM Piotr Nowojski <pnowoj...@apache.org> wrote: > Hi Sid, > > I don't see on the stackoverflow explanation of what are you trying to do > here (no mentions of MapFunction or a tuple). > > If you want to create a `DataStream<String>` from some a pre > existing/static Tuple of Strings, the easiest thing would be to convert the > tuple to a collection/iterator and use > `StreamExecutionEnvironment#fromCollection(...)`. > If you already have a `DataStream<Tuple<String>>` (for example your source > produces a tuple) and you want to flatten it to `DataStream<String>`, then > you need a simple `FlatMapFunction<Tuple<String>, String>` (or > `RichFlatMapFunction<Tuple<String>, String>`), that would do the flattening > via: > > public void flatMap(Tuple<String> value, Collector<String> out) throws > Exception { > out.collect(value.f0); > out.collect(value.f1); > ...; > out.collect(value.fN); > } > > Best, > Piotrek > > pt., 7 sty 2022 o 07:05 Siddhesh Kalgaonkar <kalgaonkarsiddh...@gmail.com> > napisaĆ(a): > >> Hi Francis, >> >> What I am trying to do is you can see over here >> https://stackoverflow.com/questions/70592174/richsinkfunction-for-cassandra-in-flink/70593375?noredirect=1#comment124796734_70593375 >> >> >> On Fri, Jan 7, 2022 at 5:07 AM Francis Conroy < >> francis.con...@switchdin.com> wrote: >> >>> Hi Siddhesh, >>> >>> How are you getting this tuple of strings into the system? I think this >>> is the important question, you can create a DataStream in many ways, from a >>> collection, from a source, etc but all of these rely on the >>> ExecutionEnvironment you're using. >>> A RichMapFunction doesn't produce a datastream directly, it's used in >>> the context of the StreamExecutionEnvironment to create a stream i.e. >>> DataStream.map([YourRichMapFunction]) this implies that you already need a >>> datastream to transform a datastream using a mapFunction >>> (MapFunction/RichMapFunction) >>> Francis >>> >>> On Fri, 7 Jan 2022 at 01:48, Siddhesh Kalgaonkar < >>> kalgaonkarsiddh...@gmail.com> wrote: >>> >>>> Hi, >>>> >>>> As I am new and I am facing one issue so I came across RichMapFunction. >>>> How can I use RichMapFunction to convert a tuple of strings to datastream? >>>> If not how can I do it apart from using StreamExecutionEnvironment? >>>> >>>> Thanks, >>>> Sid >>>> >>> >>> This email and any attachments are proprietary and confidential and are >>> intended solely for the use of the individual to whom it is addressed. Any >>> views or opinions expressed are solely those of the author and do not >>> necessarily reflect or represent those of SwitchDin Pty Ltd. If you have >>> received this email in error, please let us know immediately by reply email >>> and delete it from your system. You may not use, disseminate, distribute or >>> copy this message nor disclose its contents to anyone. >>> SwitchDin Pty Ltd (ABN 29 154893857) PO Box 1165, Newcastle NSW 2300 >>> Australia >>> >>