Book Image

Learning Apache Flink

By : Tanmay Deshpande
Book Image

Learning Apache Flink

By: Tanmay Deshpande

Overview of this book

<p>With the advent of massive computer systems, organizations in different domains generate large amounts of data on a real-time basis. The latest entrant to big data processing, Apache Flink, is designed to process continuous streams of data at a lightning fast pace.</p> <p>This book will be your definitive guide to batch and stream data processing with Apache Flink. The book begins with introducing the Apache Flink ecosystem, setting it up and using the DataSet and DataStream API for processing batch and streaming datasets. Bringing the power of SQL to Flink, this book will then explore the Table API for querying and manipulating data. In the latter half of the book, readers will get to learn the remaining ecosystem of Apache Flink to achieve complex tasks such as event processing, machine learning, and graph processing. The final part of the book would consist of topics such as scaling Flink solutions, performance optimization and integrating Flink with other tools such as ElasticSearch.</p> <p>Whether you want to dive deeper into Apache Flink, or want to investigate how to get more out of this powerful technology, you’ll find everything you need inside.</p>
Table of Contents (17 chapters)
Learning Apache Flink
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface

Operators


Flink's Table API provides various operators as part of its domain-specific language. Most of the operators are available in Java and Scala APIs. Let's look at those operators one by one.

The select operator

The select operator is like a SQL select operator which allows you to select various attributes/columns in a table.

In Java:

Table result = in.select("id, name"); 
Table result = in.select("*"); 

In Scala:

val result = in.select('id, 'name); 
val result = in.select('*); 

The where operator

The where operator is used for filtering out results.

In Java:

Table result = in.where("id = '101'"); 

In Scala:

val result = in.where('id == "101"); 

The filter operator

The filter operator can be used as a replacement for the where operator.

In Java:

Table result = in.filter("id = '101'"); 

In Scala:

val result = in.filter('id == "101"); 

The as operator

The as operator is used for renaming fields:

In Java:

Table in = tableEnv.fromDataSet(ds, "id, name"); 
Table result = in.as("order_id, order_name");...