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

SQL


Table API also allows us to write free form SQL queries using the sql() method. The method internally also uses Apache Calcite for SQL syntax verification and optimization. It executes the query and returns results in the table format. Later the table can be again transformed into either a dataset or datastream or TableSink for further processing.

One thing to note here is that, for the SQL method to access the tables, they must be registered with TableEnvironment.

More support is being added to the SQL method continuously so if any syntax is not supported, it will error out with TableException.

Now let's look at how to use the SQL method on a dataset and datastream.

SQL on datastream

SQL queries can be executed on datastreams registered with TableEnvironment using the SELECT STREAM keyword. Most of the SQL syntax is common between datasets and datastreams. To know more about stream syntax, the Apache Calcite's Streams documentation would be helpful. It can be found at: https://calcite.apache...