In-depth Analysis of Flink SQL 1.13 Features and Improvements
This article provides a comprehensive overview of Apache Flink SQL 1.13, detailing new Window TVF support, cumulate windows, performance optimizations, time‑zone handling, enhanced Hive compatibility, SQL client upgrades, DataStream‑Table conversion improvements, and outlines the roadmap for the upcoming 1.14 release.
The article begins with an overview of Flink SQL 1.13, noting that over 1,000 issues were resolved, most of which target the Table/SQL module. Five major FLIP initiatives are introduced as the backbone of the new release.
Core Feature Interpretation
FLIP‑145 adds support for Window Table‑Valued Functions (TVF), replacing the previous special SqlGroupedWindowFunction . The new syntax allows flexible window definitions without mandatory GROUP BY clauses and enables custom TVFs such as TOP‑N.
Example of the old syntax:
SELECT
TUMBLE_START(bidtime, INTERVAL '10' MINUTE),
TUMBLE_END(bidtime, INTERVAL '10' MINUTE),
TUMBLE_ROWTIME(bidtime, INTERVAL '10' MINUTE),
SUM(price)
FROM MyTable
GROUP BY TUMBLE(bidtime, INTERVAL '10' MINUTE)New TVF‑based syntax:
SELECT WINDOW_start, WINDOW_end, WINDOW_time, SUM(price)
FROM Table(TUMBLE(Table myTable, DESCRIPTOR(biztime), INTERVAL '10' MINUTE))
GROUP BY WINDOW_start, WINDOW_endThe article also explains cumulate windows, which aggregate data incrementally across overlapping intervals, and shows how the previous cumbersome SQL for cumulative UV can be replaced with a concise TVF‑based statement:
INSERT INTO cumulative_UV
SELECT WINDOW_end, COUNT(DISTINCT user_id) AS UV
FROM Table(
CUMULATE(Table user_behavior, DESCRIPTOR(ts), INTERVAL '10' MINUTES, INTERVAL '1' DAY))
GROUP BY WINDOW_start, WINDOW_endPerformance optimizations for Window TVF include memory pre‑allocation, slice reuse, operator‑level local‑global optimizations, and better handling of late data, yielding up to 2× speed‑up in benchmark tests.
Multi‑dimensional analysis (GROUPING SETS, ROLLUP, CUBE) and Window TOP‑N are now directly supported on TVF windows, simplifying complex analytical queries.
Time‑Zone and Time Function Enhancements (FLIP‑162)
The release introduces TIMESTAMP_LTZ (timestamp with local time zone) to resolve inconsistencies of PROCTIME() , CURRENT_TIMESTAMP , and related functions across different zones. PROCTIME now returns TIMESTAMP_LTZ , and time‑zone aware processing is applied to both streaming and batch modes.
Summer‑time handling is also fixed by leveraging TIMESTAMP_LTZ , eliminating the need for manual 8‑hour offsets.
Important Improvements
FLIP‑152 enhances Hive compatibility, adding support for common Hive DML/DQL syntax via a Hive dialect.
FLIP‑163 upgrades the SQL client with initialization flags ( -i ), file execution ( -f ), verbose mode, runtime mode selection, job naming, savepoint paths, and statement‑set support for multi‑sink queries.
FLIP‑136 improves DataStream‑Table conversion, preserving event time and watermarks, and adds changelog stream conversion APIs: // DATASTREAM to Table StreamTableEnvironment.fromChangelogStream(DataStream ) // Table to DATASTREAM StreamTableEnvironment.toChangelogStream(Table)
Flink SQL 1.14 Roadmap
Removal of the legacy planner in favor of Blink‑Planner.
Full support for session windows and additional TVF features such as allow‑lateness .
Enhanced schema handling across the pipeline.
Broader Flink CDC integration for upstream change‑data‑capture sources.
Conclusion
The article summarizes that Flink SQL 1.13 brings Window TVF, robust time‑zone handling, better Hive integration, an improved SQL client, and richer DataStream‑Table interoperability, while also previewing the upcoming enhancements in version 1.14.
DataFunTalk
Dedicated to sharing and discussing big data and AI technology applications, aiming to empower a million data scientists. Regularly hosts live tech talks and curates articles on big data, recommendation/search algorithms, advertising algorithms, NLP, intelligent risk control, autonomous driving, and machine learning/deep learning.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.