flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Robutti <simone.robu...@radicalbit.io>
Subject Re: Bug while using Table API
Date Wed, 04 May 2016 13:25:39 GMT
Here is the code:

package org.example

import org.apache.flink.api.scala._
import org.apache.flink.api.table.TableEnvironment

object Job {
  def main(args: Array[String]) {
    // set up the execution environment
    val env = ExecutionEnvironment.getExecutionEnvironment
    val tEnv = TableEnvironment.getTableEnvironment(env)


    val input = env.fromElements(WC("hello", 1), WC("hello", 1), WC("ciao",
1))
    val expr = tEnv.fromDataSet(input)
    val result = expr
      .groupBy("word")
      .select("word , count.sum as count")
    tEnv.toDataSet[WC](result).print()

    env.execute("Flink Scala API Skeleton")
  }
}

case class WC(word:String,count:Int)

Mime
View raw message