flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Balaji Rajagopalan <balaji.rajagopa...@olacabs.com>
Subject Re: how to convert DataStream to DataSet
Date Wed, 16 Mar 2016 05:37:02 GMT
There was a similar question before the answer was to use
org.apache.flink.api.common.io.OutputFormat to do the conversion.

On Tue, Mar 15, 2016 at 7:48 PM, subash basnet <yasubash@gmail.com> wrote:

> Hello all,
>
> In WikipediaAnalysis.java we get *result *of type *DataStream<Tuple2<String,
> Long>>*,
>
> I would want to convert *result* to *newResult* of type
> *DataSet<Tuple1<String>>*,
>
> So tried the following:
> DataSet<Tuple1<String>>newResult = result.map(new getResult());
>
> public static final class getResult implements MapFunction<Tuple2<String,
> Long>, Tuple1<String>> {
>
> @Override
> public Tuple1<String> map(Tuple2<String, Long> value) {
> return new Tuple1<String>(value.f1 + "");
> }
> }
>
> But there is type mismatch, with error as:
> *Type mismatch: cannot convert from
> SingleOutputStreamOperator<Tuple1<String>> to DataSet<Tuple1<String>>*
>
>
> Best Regards,
> Subash Basnet
>

Mime
View raw message