Stream analytics with SQL on Apache Flink
Although the most widely used language for data analysis, SQL is only slowly being adopted by open source stream processors. One reason is that SQL's semantics and syntax were not designed with streaming data in mind. Fabian Hueske explores Apache Flink's two relational APIs for streaming analyticsstandard SQL and the LINQ-style Table APIdiscussing their semantics and showcasing their usage.
Talk Title | Stream analytics with SQL on Apache Flink |
Speakers | Fabian Hueske (data Artisans) |
Conference | Strata Data Conference |
Conf Tag | Making Data Work |
Location | London, United Kingdom |
Date | May 23-25, 2017 |
URL | Talk Page |
Slides | Talk Slides |
Video | |
SQL is undoubtedly the most widely used language for data analytics, and for good reason. It is declarative, and many SQL database systems and query processors feature advanced query optimizers and highly efficient execution engines. SQL has become the standard that everybody knows and uses. With stream processing technology becoming mainstream, why isn’t SQL widely supported by open source stream processors? SQL’s semantics and syntax were not designed with the characteristics of streaming data in mind. Consequently, systems that want to provide support for SQL on data streams have to overcome a conceptual gap. One approach is to support standard SQL, which is well known but requires cumbersome workarounds for many common streaming computations. Other approaches are to design custom SQL-inspired stream analytics languages or to extend SQL with streaming-specific keywords. While such solutions tend to result in more intuitive syntax, they suffer from not being established standards and thereby exclude many users and tools. Apache Flink is a distributed stream processing system with very good support for streaming analytics. Flink features two relational APIs, the Table API and SQL. The Table API is a language-integrated relational API with stream-specific features. Flink’s SQL interface implements the plain SQL standard. Both APIs are semantically compatible and share the same optimization and execution path based on Apache Calcite. Fabian Hueske explores Apache Flink’s relational APIs for stream analytics, discussing their conceptual model and showcasing their usage. The central concept of these APIs is dynamic tables. Fabian explains how streams are converted into dynamic tables and vice versa without losing information due to the stream-table duality. Relational queries on dynamic tables behave similarly to materialized view definitions and produce new dynamic tables. Fabian demonstrates how dynamic tables are converted back into changelog streams or are written as materialized views to external systems, such as Apache Kafka or Apache Cassandra, and are updated in place with low latency. Fabian then highlights the power and expressiveness of Flink’s relational APIs by outlining common stream analytics use cases.