// Word count in Scala
// set up the execution environment
val env = ExecutionEnvironment.getExecutionEnvironment
// get input data
val text = env.fromElements(
"To be, or not to be --that is the question:--",
"Whether 'tis nobler in the mind to suffer",
"The slings and arrows of outrageous fortune",
"Or to take arms against a sea of troubles")
// count
val counts = text
.flatMap { _.toLowerCase.split("\\W+") }
.map { (_, 1) }
.groupBy(0)
.sum(1)
// emit result and print result
counts.print()
Slide 13
Slide 13 text
// Word count in Java
// set up the execution environment
// (লུ)
// get input data
// (লུ)
// count
DataStream> counts = text
.flatMap((String line, Collector out) -> {
String[] tokens = line.toLowerCase().split("\\W+");
Arrays.stream(tokens)
.forEach(out::collect);
})
.map(s -> new Tuple2<>(s, 1))
.groupBy(0)
.sum(1);
// emit result and print result
// (লུ)
Slide 14
Slide 14 text
Flink DataStream API
Programming Guide
ʹαϯϓϧίʔυ͕͋Γ·͢
https://ci.apache.org/projects/flink/flink-docs-master/dev/datastream_api.html
Slide 15
Slide 15 text
FlinkLINEͰ
ΘΕ͍ͯ·͢
Slide 16
Slide 16 text
ڈͷΧϯϑΝϨϯεͰհ͞Ε͍ͯΔͷͰ
ৄͦͪ͘͠ΒΛݟͯԼ͍͞
ʢಈըɾεϥΠυ͕ެ։͞Εͯ·͢ʣ
• LINE DEVELOPER DAY 2016
https://engineering.linecorp.com/ja/blog/detail/87
• B-6 ηογϣϯ
New stream processing platform with Apache Flink