Commit a3eb0138 authored by 赵威's avatar 赵威

update project's name

parent 21c94040
// ThisBuild / scalaVersion := "2.12.13" // ThisBuild / scalaVersion := "2.12.13"
ThisBuild / scalaVersion := "2.11.12" ThisBuild / scalaVersion := "2.11.12"
ThisBuild / version := "0.1.0" ThisBuild / version := "0.1.0"
ThisBuild / organization := "com.gmei" ThisBuild / organization := "com.gmei.up"
val esVersion = "7.10.2" val esVersion = "7.10.2"
val es = "org.elasticsearch" % "elasticsearch" % esVersion val es = "org.elasticsearch" % "elasticsearch" % esVersion
...@@ -22,7 +22,7 @@ val flinkHadoop = "org.apache.flink" %% "flink-hadoop-compatibility" % flinkVers ...@@ -22,7 +22,7 @@ val flinkHadoop = "org.apache.flink" %% "flink-hadoop-compatibility" % flinkVers
lazy val root = (project in file(".")) lazy val root = (project in file("."))
.settings( .settings(
name := "tryFlink", name := "streamingUserPortrait",
// libraryDependencies += "com.alibaba" % "fastjson" % "1.2.75", // libraryDependencies += "com.alibaba" % "fastjson" % "1.2.75",
libraryDependencies += es, libraryDependencies += es,
......
package com.gmei package com.gmei.up
// import org.apache.flink.api.scala._
import org.apache.flink.streaming.api.scala._ import org.apache.flink.streaming.api.scala._
object Main { object Main {
...@@ -8,20 +7,10 @@ object Main { ...@@ -8,20 +7,10 @@ object Main {
println("hello") println("hello")
val env = StreamExecutionEnvironment.getExecutionEnvironment val env = StreamExecutionEnvironment.getExecutionEnvironment
val socketStream = env.socketTextStream("localhost", 9000) val a = env.fromElements(1, 2, -3, 0, 5, -9, 8)
val b = a.map(_ + 1)
// val a = env.fromElements(1, 2, -3, 0, 5, -9, 8) b.print()
// val b = a.map(_ + 1)
// b.print()
val wordsStream = socketStream.flatMap(value => value.split("\\s+")).map(value => (value, 1))
val keyValuePair = wordsStream.keyBy(0)
val countPair = keyValuePair.sum(1)
countPair.print
env.execute env.execute
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment