Questions tagged [apache-flink]

Apache Flink is an open source platform for scalable batch and stream data processing. Flink supports batch and streaming analytics, in one system. Analytical programs can be written in concise and elegant APIs in Java and Scala.

Apache Flink

Apache Flink is an open source platform for scalable batch and stream data processing. Flink supports batch and streaming analytics, in one system. Analytical programs can be written in concise and elegant APIs in Java and Scala.

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

val text = env.readTextFile(path)

val counts = text.flatMap { _.split("\\W+") }
  .map { WordWithCount(_, 1) }
  .groupBy("word")
  .sum("count")

counts.writeAsCsv(outputPath)

These are some of the unique features of Flink:

  • Hybrid batch/streaming runtime that supports batch processing and data streaming programs.
  • Custom memory management to guarantee efficient, adaptive, and highly robust switching between in-memory and out-of-core data processing algorithms.
  • Flexible and expressive windowing semantics for data stream programs.
  • Built-in program optimizer that chooses the proper runtime operations for each program.
  • Custom type analysis and serialization stack for high performance.

Learn more about Flink here.

Building Apache Flink from Source

Prerequisites for building Flink:

  • Unix-like environment (We use Linux, Mac OS X, Cygwin)
  • git
  • Maven (at least version 3.0.4)
  • Java 6, 7 or 8 (Note that Oracle's JDK 6 library will fail to build Flink, but is able to run a pre-compiled package without problem)

Commands:

git clone https://github.com/apache/flink.git
cd flink
mvn clean package -DskipTests

Flink is now installed in build-target

Developing Flink

The Flink committers use IntelliJ IDEA and Eclipse IDE to develop the Flink codebase.

Minimal requirements for an IDE are:

  • Support for Java and Scala (also mixed projects)
  • Support for Maven with Java and Scala

IntelliJ IDEA

The IntelliJ IDE supports Maven out of the box and offers a plugin for Scala development.

Check out our Setting up IntelliJ guide for details.

Eclipse Scala IDE

For Eclipse users, we recommend using Scala IDE 3.0.3, based on Eclipse Kepler. While this is a slightly older version, we found it to be the version that works most robustly for a complex project like Flink.

Further details, and a guide to newer Scala IDE versions can be found in the How to setup Eclipse docs.

Note: Before following this setup, make sure to run the build from the command line once (mvn clean install -DskipTests, see above)

  1. Download the Scala IDE (preferred) or install the plugin to Eclipse Kepler. See How to setup Eclipse for download links and instructions.
  2. Add the "macroparadise" compiler plugin to the Scala compiler. Open "Window" -> "Preferences" -> "Scala" -> "Compiler" -> "Advanced" and put into the "Xplugin" field the path to the macroparadise jar file (typically "/home/-your-user-/.m2/repository/org/scalamacros/paradise_2.10.4/2.0.1/paradise_2.10.4-2.0.1.jar"). Note: If you do not have the jar file, you probably did not run the command line build.
  3. Import the Flink Maven projects ("File" -> "Import" -> "Maven" -> "Existing Maven Projects")
  4. During the import, Eclipse will ask to automatically install additional Maven build helper plugins.
  5. Close the "flink-java8" project. Since Eclipse Kepler does not support Java 8, you cannot develop this project.

Support

Don’t hesitate to ask!

Contact the developers and community on the mailing lists if you need any help.

Open an issue if you found a bug in Flink.

Documentation

The documentation of Apache Flink is located on the website: http://flink.apache.org or in the docs/ directory of the source code.

Fork and Contribute

This is an active open-source project. We are always open to people who want to use the system or contribute to it. Contact us if you are looking for implementation tasks that fit your skills. This article describes how to contribute to Apache Flink.

About

Apache Flink is an open source project of The Apache Software Foundation (ASF). The Apache Flink project originated from the Stratosphere research project.

7452 questions
10
votes
1 answer

flink job is not distributed across machines

I have small use case in Apache flink, which is, a batch processing system. I need to process a colletion of files. Processing of each file must be handled by one machine. I have this below code. All the time only one task slot is occupied, and the…
Bala
  • 675
  • 2
  • 7
  • 23
10
votes
3 answers

How to use multi-thread consumer in kafka 0.9.0?

The doc of kafka give an approach about with following describes: One Consumer Per Thread:A simple option is to give each thread its own consumer > instance. My code: public class KafkaConsumerRunner implements Runnable { private final…
10
votes
1 answer

Flink streaming event time window ordering

I'm running into some troubles understanding the semantics around event time windowing. The following program generates some tuples with timestamps that are used as event time and does a simple window aggregation. I would expect the output to be in…
bandrews
  • 101
  • 1
  • 5
10
votes
2 answers

Using an Collections$UnmodifiableCollection with Apache Flink

While using Apache Flink with the following code: DataStream> result = source.window(Time.of(1, TimeUnit.SECONDS)).mapWindow(new WindowMapFunction>() { @Override public void mapWindow(Iterable
Robert Metzger
  • 4,452
  • 23
  • 50
10
votes
1 answer

What does "streaming" mean in Apache Spark and Apache Flink?

As I went to Apache Spark Streaming Website, I saw a sentence: Spark Streaming makes it easy to build scalable fault-tolerant streaming applications. And in Apache Flink Website, there is a sentence: Apache Flink is an open source platform for…
xirururu
  • 5,028
  • 9
  • 35
  • 64
9
votes
2 answers

Flink Kafka EXACTLY_ONCE causing KafkaException ByteArraySerializer is not an instance of Serializer

So, I'm trying to enable EXACTLY_ONCE semantic in my Flink Kafka streaming job along with checkpointing. However I am not getting it to work, so I tried downloading the test sample code from…
Olindholm
  • 340
  • 4
  • 16
9
votes
1 answer

Difference between job, task and subtask in flink

I'm new to flink and try to understand: job task subtask I searched in the docs but still did not get it. What's the main diffence between them?
xingbin
  • 27,410
  • 9
  • 53
  • 103
9
votes
5 answers

Confused about FLINK task slot

I know a task manager could have several task slots. But, what is a task slot ? A JVM process or an object in memory or a thread?
Brutal_JL
  • 2,839
  • 2
  • 21
  • 27
9
votes
1 answer

Why would someone run Spark / Flink on Tez?

In the Tez paper from Saha et al., the following modular architecture of Hadoop 2 with Tez is shown: Why would someone run Spark/Flink on Tez? What are the advantages? Better utilization of YARN?
j9dy
  • 2,029
  • 3
  • 25
  • 39
9
votes
4 answers

Local Flink config running standalone from IDE

If I'd like to run a Flink app locally, directly from within Intellij but I need to specify config params (like fs.hdfs.hdfssite to set up S3 access), is there any other way to provide those config params apart from…
bibac
  • 449
  • 8
  • 17
9
votes
1 answer

How do Apache Flink's JoinFunction and CoGroupFunction differ?

What is the difference between a JoinFunction and a CoGroupFunction in Apache Flink? How do semantics and execution differ?
Jary zhen
  • 437
  • 6
  • 18
9
votes
2 answers

How to handle errors in custom MapFunction correctly?

I have implemented MapFunction for my Apache Flink flow. It is parsing incoming elements and convert them to other format but sometimes error can appear (i.e. incoming data is not valid). I see two possible ways how to handle it: Ignore invalid…
Maxim
  • 9,701
  • 5
  • 60
  • 108
9
votes
1 answer

Global sorting in Apache Flink

sortPartition method of a dataset sorts the dataset locally based on some specified fields. How can I get my large Dataset sorted globally in an efficient way in Flink?
Ahmad.S
  • 779
  • 6
  • 25
9
votes
1 answer

Degree of parallelism in Apache Flink

Can I set different degree of parallelism for different part of the task in our program in Flink? For instance, how does Flink interpret the following sample code? The two custom practitioners MyPartitioner1, MyPartitioner2, partition the input…
Ahmad.S
  • 779
  • 6
  • 25
9
votes
1 answer

Flink: DataSource's outputs caused an error: Could not read the user code wrapper

I Am just starting flink. I wrote following code and got "DataSource's outputs caused an error: Could not read the user code wrapper" error Is there any thing I am doing wrong? version : Flink v 0.9.1 (hadoop 1) not using hadoop: Local…
ashish
  • 125
  • 4