flink1.0 DataStream groupby

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

flink1.0 DataStream groupby

rimin515
Hi,
    today,I use flink to rewrite my spark project,in spark ,data is rdd,and it have much transformations and actions,but in flink,the DataStream does not have groupby and foreach,
      for example, 
       
val env=StreamExecutionEnvironment.createLocalEnvironment()
      val data=List(("1"->"a"),("2"->"b"),("1"->"c"),("2"->"f"))
      val ds=env.fromCollection(data)
      val dskeyby=ds.groupBy(0)
      ds.print()
     env.execute()

the code "val dskeyby=ds.groupBy(0)" is error,say "value groupBy is not a member of org.apache.flink.streaming.api.scala.DataStream"
so , the solution is?
--------------------------------




Reply | Threaded
Open this post in threaded view
|

Re: flink1.0 DataStream groupby

Suneel Marthi
It should be keyBy(0) for DataStream API (since Flink 0.9) 

Its groupBy() in DataSet API.

On Fri, Jul 22, 2016 at 1:27 AM, <[hidden email]> wrote:
Hi,
    today,I use flink to rewrite my spark project,in spark ,data is rdd,and it have much transformations and actions,but in flink,the DataStream does not have groupby and foreach,
      for example, 
       
val env=StreamExecutionEnvironment.createLocalEnvironment()
      val data=List(("1"->"a"),("2"->"b"),("1"->"c"),("2"->"f"))
      val ds=env.fromCollection(data)
      val dskeyby=ds.groupBy(0)
      ds.print()
     env.execute()

the code "val dskeyby=ds.groupBy(0)" is error,say "value groupBy is not a member of org.apache.flink.streaming.api.scala.DataStream"
so , the solution is?
--------------------------------