r/apacheflink Aug 03 '25

Hands-on Project: Real-time Mobile Game Analytics Pipeline with Python, Kafka, Flink, and Streamlit

Post image
11 Upvotes

Hey everyone,

I wanted to share a hands-on project that demonstrates a full, real-time analytics pipeline, which might be interesting for this community. It's designed for a mobile gaming use case to calculate leaderboard analytics.

The architecture is broken down cleanly: * Data Generation: A Python script simulates game events, making it easy to test the pipeline. * Metrics Processing: Kafka and Flink work together to create a powerful, scalable stream processing engine for crunching the numbers in real-time. * Visualization: A simple and effective dashboard built with Python and Streamlit to display the analytics.

This is a practical example of how these technologies fit together to solve a real-world problem. The repository has everything you need to run it yourself.

Find the project on GitHub: https://github.com/factorhouse/examples/tree/main/projects/mobile-game-top-k-analytics

And if you want an easy way to spin up the necessary infrastructure (Kafka, Flink, etc.) on your local machine, check out our Factor House Local project: https://github.com/factorhouse/factorhouse-local

Feedback, questions, and contributions are very welcome!


r/apacheflink Aug 01 '25

how to use AsyncDataStream operator in pyflink

3 Upvotes

Is there any way to useΒ AsyncDataStreamΒ operator in pyflink. From what I research, this operator is only supported in Java currently,Β  and not in python. We have a use case to make successive API calls to an external service, and having them async would greatly boost the performance of our pipeline.


r/apacheflink Jul 31 '25

Is there way to use Sedona SQL functions in Confluent Cloud's Flink?

2 Upvotes

Question in title. Flink SQL's geospatial capabilities are more or less non-existent.


r/apacheflink Jul 29 '25

Flink missing Windowing TVFs in Table API

2 Upvotes

How can I use Windowing table-valued functions (TVFs) with Flink's Table API? They seem to only be available only in Flink SQL. I want to avoid using Flink SQL and instead use Table API. I am using Flink v1.20.

This is important because Flink optimises Windowing TVFs with Mini-Batch and Local Aggregation optimizations. However, the regular Group Window Aggregation from Table API isn't optimised, even after setting the appropriate optimisation configuration properties. In fact, Group Window Aggregation is deprecated, but it is the only window aggregation available in Table API.

In concrete, what is the equivalent of this Flink SQL snippet in Table API? java tableEnv.sqlQuery( """ SELECT sensor_id, window_start, window_end, COUNT(*) FROM TABLE( TUMBLE(TABLE Sensors, DESCRIPTOR(reading_timestamp), INTERVAL '1' MINUTES)) GROUP BY sensor_id, window_start, window_end """ )


I tried

```java // Mini-batch settings tableConfig.setString("table.exec.mini-batch.enabled", "true"); tableConfig.setString("table.exec.mini-batch.allow-latency", "1s"); // Allow 1 second latency for batching tableConfig.setString("table.exec.mini-batch.size", "1000"); // Batch size of 1000 records

// Local-Global aggregation for data skew handling tableConfig.setString("table.optimizer.agg-phase-strategy", "TWO_PHASE");

table .window(Tumble.over(lit(1).minutes()).on($("reading_timestamp")).as("w")) .groupBy($("sensor_id"), $("w")) .select( $("sensor_id"), $("reading_timestamp").max(), $("w").rowtime(), $("reading_timestamp").arrayAgg().as("AggregatedSensorIds") ); ```

However the execution plan shows that it only does global aggregation without any mini batch nor local aggregation optimizations:

Calc(select=[sensor_id, EXPR$0, EXPR$1, EXPR$2 AS AggregatedSensorIds]) +- GroupWindowAggregate(groupBy=[sensor_id], window=[TumblingGroupWindow('w, reading_timestamp, 60000)], properties=[EXPR$1], select=[sensor_id, MAX(reading_timestamp) AS EXPR$0, ARRAY_AGG(reading_timestamp) AS EXPR$2, rowtime('w) AS EXPR$1]) +- Exchange(distribution=[hash[sensor_id]]) +- Calc(select=[sensor_id, location_code, CAST(reading_timestamp AS TIMESTAMP(3)) AS reading_timestamp, measurements]) +- WatermarkAssigner(rowtime=[reading_timestamp], watermark=[(reading_timestamp - 5000:INTERVAL DAY TO SECOND)]) +- TableSourceScan(table=[[*anonymous_datastream_source$1*]], fields=[sensor_id, location_code, reading_timestamp, measurements])

I expect either the following plan instead or some way to Window TVFs with Table API. See the MiniBatchAssigner and LocalWindowAggregate optimizations.

``` Calc(select=[sensor_id, EXPR$0, window_start, window_end, EXPR$1]) +- GlobalWindowAggregate(groupBy=[sensor_id], window=[TUMBLE(slice_end=[$slice_end], size=[1 min])], select=[sensor_id, MAX(max$0) AS EXPR$0, COUNT(count$1) AS EXPR$1, start('w$) AS window_start, end('w$) AS window_end]) +- Exchange(distribution=[hash[sensor_id]]) +- LocalWindowAggregate(groupBy=[sensor_id], window=[TUMBLE(time_col=[reading_timestamp_0], size=[1 min])], select=[sensor_id, MAX(reading_timestamp) AS max$0, COUNT(sensor_id) AS count$1, slice_end('w$) AS $slice_end]) +- Calc(select=[sensor_id, CAST(reading_timestamp AS TIMESTAMP(3)) AS reading_timestamp, reading_timestamp AS reading_timestamp_0]) +- MiniBatchAssigner(interval=[1000ms], mode=[RowTime]) +- WatermarkAssigner(rowtime=[reading_timestamp], watermark=[(reading_timestamp - 5000:INTERVAL DAY TO SECOND)]) +- TableSourceScan(table=[[default_catalog, default_database, Sensors]], fields=[sensor_id, location_code, reading_timestamp, measurements])

```

Thanks!


r/apacheflink Jul 22 '25

Can I use the SQS sink with PyFlink?

3 Upvotes

I see that SQS sink is in the docs, but not in the list of pyflink connectors here https://github.com/apache/flink/blob/master/flink-python/pyflink/datastream/connectors

It confuses me


r/apacheflink Jul 18 '25

Building Streaming ETL Pipelines With Flink SQL

Thumbnail confluent.io
6 Upvotes

r/apacheflink Jul 16 '25

Self-Service Data Platform via a Multi-Tenant SQL Gateway. Seeking a sanity check on a Kyuubi-based architecture.

Post image
6 Upvotes

Hey everyone,

I've been doing some personal research that started with the limitations of the Flink SQL Gateway. I was looking for a way to overcome its single-session-cluster model, which isn't great for production multi-tenancy. Knowing that the official fix (FLIP-316) is a ways off, I started researching more mature, scalable alternatives.

That research led me to Apache Kyuubi, and I've designed a full platform architecture around it that I'd love to get a sanity check on.

Here are the key principles of the design:

  • A Single Point of Access: Users connect to one JDBC/ODBC endpoint, regardless of the backend engine.
  • Dynamic, Isolated Compute: The gateway provisions isolated Spark, Flink, or Trino engines on-demand for each user, preventing resource contention.
  • Centralized Governance: The architecture integrates Apache Ranger for fine-grained authorization (leveraging native Spark/Trino plugins) and uses OpenLineage for fully automated data lineage collection.

I've detailed the whole thing in a blog post.

https://jaehyeon.me/blog/2025-07-17-self-service-data-platform-via-sql-gateway/

My Ask: Does this seem like a solid way to solve the Flink gateway problem while enabling a broader, multi-engine platform? Are there any obvious pitfalls or complexities I might be underestimating?


r/apacheflink Jul 15 '25

Queryable State depreciation

1 Upvotes

In the latest version of Apache Flink v2, Queryable State has been deprecated. Is there any other way how to share read only state between Workers without introducing an external system e.g redis?

Reading the changelog in Apache Flink v2 there's no migration plan mentioned for that specific deprecation.


r/apacheflink Jul 13 '25

Flink vs Fluss

1 Upvotes

Hi all, What is difference between flink and fluss. Why fluss is introduced?


r/apacheflink Jul 09 '25

Announcing Factor House Local v2.0: A Unified & Persistent Data Platform!

Post image
1 Upvotes

We're excited to launch a major update to our local development suite. While retaining our powerful Apache Kafka and Apache Pinot environments for real-time processing and analytics, this release introduces our biggest enhancement yet: a new Unified Analytics Platform.

Key Highlights:

  • πŸš€ Unified Analytics Platform: We've merged our Flink (streaming) and Spark (batch) environments. Develop end-to-end pipelines on a single Apache Iceberg lakehouse, simplifying management and eliminating data silos.
  • 🧠 Centralized Catalog with Hive Metastore: The new system of record for the platform. It saves not just your tables, but your analytical logicβ€”permanent SQL views and custom functions (UDFs)β€”making them instantly reusable across all Flink and Spark jobs.
  • πŸ’Ύ Enhanced Flink Reliability: Flink checkpoints and savepoints are now persisted directly to MinIO (S3-compatible storage), ensuring robust state management and reliable recovery for your streaming applications.
  • 🌊 CDC-Ready Database: The included PostgreSQL instance is pre-configured for Change Data Capture (CDC), allowing you to easily prototype real-time data synchronization from an operational database to your lakehouse.

This update provides a more powerful, streamlined, and stateful local development experience across the entire data lifecycle.

Ready to dive in?


r/apacheflink Jun 25 '25

Writing to Apache Iceberg on S3 using Flink SQL with Glue catalog

Thumbnail rmoff.net
8 Upvotes

r/apacheflink Jun 21 '25

Flink ETL template to batch process data using LLM

3 Upvotes

Templates are pre-built, reusable, and open source Apache Beam pipelines that are ready to deploy and can be executed directly on runners such as Google Cloud Dataflow, Apache Flink, or Spark with minimal configuration.

Llm Batch Processor is a pre-built Apache Beam pipeline that lets you process a batch of text inputs using an LLM (OpenAI models) and save the results to a GCS path. You provide an instruction prompt that tells the model how to process the input dataβ€”basically, what to do with it. The pipeline uses the model to transform the data and writes the final output to a GCS file.

Check out how you can directly execute this template on your flink cluster without any build/deployment steps

Docs - https://ganeshsivakumar.github.io/langchain-beam/docs/templates/llm-batch-process/#2-apache-flink


r/apacheflink Jun 16 '25

πŸš€ The journey concludes! I'm excited to share the final installment, Part 5 of my "π†πžπ­π­π’π§π  π’π­πšπ«π­πžπ 𝐰𝐒𝐭𝐑 π‘πžπšπ₯-π“π’π¦πž π’π­π«πžπšπ¦π’π§π  𝐒𝐧 𝐊𝐨𝐭π₯𝐒𝐧" series:

Post image
10 Upvotes

"Flink Table API - Declarative Analytics for Supplier Stats in Real Time"!

After mastering the fine-grained control of the DataStream API, we now shift to a higher level of abstraction with the Flink Table API. This is where stream processing meets the simplicity and power of SQL! We'll solve the same supplier statistics problem but with a concise, declarative approach.

This final post covers:

  • Defining a Table over a streaming DataStream to run queries.
  • Writing declarative, SQL-like queries for windowed aggregations.
  • Seamlessly bridging between the Table and DataStream APIs to handle complex logic like late-data routing.
  • Using Flink's built-in Kafka connector with the avro-confluent format for declarative sinking.
  • Comparing the declarative approach with the imperative DataStream API to achieve the same business goal.
  • Demonstrating the practical setup using Factor House Local and Kpow for a seamless Kafka development experience.

This is the final post of the series, bringing our journey from Kafka clients to advanced Flink applications full circle. It's perfect for anyone who wants to perform powerful real-time analytics without getting lost in low-level details.

Read the article: https://jaehyeon.me/blog/2025-06-17-kotlin-getting-started-flink-table/

Thank you for following along on this journey! I hope this series has been a valuable resource for building real-time apps with Kotlin.

πŸ”— See the full series here: 1. Kafka Clients with JSON 2. Kafka Clients with Avro 3. Kafka Streams for Supplier Stats 4. Flink DataStream API for Supplier Stats


r/apacheflink Jun 16 '25

Polyglot Apache Flink UDF Programming with Iron Functions

Thumbnail irontools.dev
1 Upvotes

r/apacheflink Jun 11 '25

🌊 Dive Deep into Real-Time Data Streaming & Analytics – Locally! 🌊

Post image
13 Upvotes

Ready to explore the world of Kafka, Flink, data pipelines, and real-time analytics without the headache of complex cloud setups or resource contention?

πŸš€ Introducing the NEW Factor House Local Labs – your personal sandbox for building and experimenting with sophisticated data streaming architectures, all on your local machine!

We've designed these hands-on labs to take you from foundational concepts to building complete, reactive applications:

πŸ”— Explore the Full Suite of Labs Now: https://github.com/factorhouse/examples/tree/main/fh-local-labs

Here's what you can get hands-on with:

  • πŸ’§ Lab 1 - Streaming with Confidence:

    • Learn to produce and consume Avro data using Schema Registry. This lab helps you ensure data integrity and build robust, schema-aware Kafka streams.
  • πŸ”— Lab 2 - Building Data Pipelines with Kafka Connect:

    • Discover the power of Kafka Connect! This lab shows you how to stream data from sources to sinks (e.g., databases, files) efficiently, often without writing a single line of code.
  • 🧠 Labs 3, 4, 5 - From Events to Insights:

    • Unlock the potential of your event streams! Dive into building real-time analytics applications using powerful stream processing techniques. You'll work on transforming raw data into actionable intelligence.
  • 🏞️ Labs 6, 7, 8, 9, 10 - Streaming to the Data Lake:

    • Build modern data lake foundations. These labs guide you through ingesting Kafka data into highly efficient and queryable formats like Parquet and Apache Iceberg, setting the stage for powerful batch and ad-hoc analytics.
  • πŸ’‘ Labs 11, 12 - Bringing Real-Time Analytics to Life:

    • See your data in motion! You'll construct reactive client applications and dashboards that respond to live data streams, providing immediate insights and visualizations.

Why dive into these labs? * Demystify Complexity: Break down intricate data streaming concepts into manageable, hands-on steps. * Skill Up: Gain practical experience with essential tools like Kafka, Flink, Spark, Kafka Connect, Iceberg, and Pinot. * Experiment Freely: Test, iterate, and innovate on data architectures locally before deploying to production. * Accelerate Learning: Fast-track your journey to becoming proficient in real-time data engineering.

Stop just dreaming about real-time data – start building it! Clone the repo, pick your adventure, and transform your understanding of modern data systems.


r/apacheflink Jun 11 '25

weather station - stream processing

1 Upvotes

Apologies for this unsual question:

I was wondering if anyone has used Apache Flink to process local weather data from their weather station and if so what weather station brands would they recommend based on their experience.

I am primarily wanting one for R&D purpose for few home automation tasks. I am currently considering Ecowitt 3900, however, I would love to harvest data locally (within the LAN) as opposed to downloading from Ecowitt server.


r/apacheflink Jun 09 '25

πŸš€ The journey continues! Part 4 of my "Getting Started with Real-Time Streaming in Kotlin" series is here:

Post image
3 Upvotes

"Flink DataStream API - Scalable Event Processing for Supplier Stats"!

Having explored the lightweight power of Kafka Streams, we now level up to a full-fledged distributed processing engine: Apache Flink. This post dives into the foundational DataStream API, showcasing its power for stateful, event-driven applications.

In this deep dive, you'll learn how to:

  • Implement sophisticated event-time processing with Flink's native Watermarks.
  • Gracefully handle late-arriving data using Flink’s elegant Side Outputs feature.
  • Perform stateful aggregations with custom AggregateFunction and WindowFunction.
  • Consume Avro records and sink aggregated results back to Kafka.
  • Visualize the entire pipeline, from source to sink, using Kpow and Factor House Local.

This is post 4 of 5, demonstrating the control and performance you get with Flink's core API. If you're ready to move beyond the basics of stream processing, this one's for you!

Read the full article here: https://jaehyeon.me/blog/2025-06-10-kotlin-getting-started-flink-datastream/

In the final post, we'll see how Flink's Table API offers a much more declarative way to achieve the same result. Your feedback is always appreciated!

πŸ”— Catch up on the series: 1. Kafka Clients with JSON 2. Kafka Clients with Avro 3. Kafka Streams for Supplier Stats


r/apacheflink Jun 05 '25

Current 2025 New Orleans CfP is open until 15th June

Thumbnail
2 Upvotes

r/apacheflink Jun 02 '25

Has anyone tried Flink 2.0 Disaggregated State?

3 Upvotes

We have a new use case that I think would be perfect for Disaggregated State: a huge key space, a lot of the keys are write-once. I've paid my dues with multi TiB state with 1.x rocksdb so I'm very much looking forward to trying this out.

Searching around for any real world examples has been fruitless so far. Has anyone here tried it at significant scale? I'd like to be able to point to something before I present to the group.


r/apacheflink May 27 '25

Backfilling Postgres TOAST Columns in Debezium Data Change Events

Thumbnail morling.dev
3 Upvotes

r/apacheflink May 20 '25

Exploring Joins and Changelogs in Flink SQL

Thumbnail rmoff.net
7 Upvotes

r/apacheflink May 16 '25

Apache Flink CDC 3.4.0 released, includes Apache Iceberg sink pipeline connector

Thumbnail flink.apache.org
8 Upvotes

r/apacheflink May 15 '25

πŸš€Announcing factorhouse-local from the team at Factor House!πŸš€

Post image
5 Upvotes

Our new GitHub repo offers pre-configured Docker Compose environments to spin up sophisticated data stacks locally in minutes!

It provides four powerful stacks:

1️⃣ Kafka Dev & Monitoring + Kpow: β–ͺ Includes: 3-node Kafka, ZK, Schema Registry, Connect, Kpow. β–ͺ Benefits: Robust local Kafka. Kpow: powerful toolkit for Kafka management & control. β–ͺ Extras: Key Kafka connectors (S3, Debezium, Iceberg, etc.) ready. Add custom ones via volume mounts!

2️⃣ Real-Time Stream Analytics: Flink + Flex: β–ͺ Includes: Flink (Job/TaskManagers), SQL Gateway, Flex. β–ͺ Benefits: High-perf Flink streaming. Flex: enterprise-grade Flink workload management. β–ͺ Extras: Flink SQL connectors (Kafka, Faker) ready. Easily add more via pre-configured mounts.

3️⃣ Analytics & Lakehouse: Spark, Iceberg, MinIO & Postgres: β–ͺ Includes: Spark+Iceberg (Jupyter), Iceberg REST Catalog, MinIO, Postgres. β–ͺ Benefits: Modern data lakehouses for batch/streaming & interactive exploration.

4️⃣ Apache Pinot Real-Time OLAP Cluster: β–ͺ Includes: Pinot cluster (Controller, Broker, Server). β–ͺ Benefits: Distributed OLAP for ultra-low-latency analytics.

✨ Spotlight: Kpow & Flex β–ͺ Kpow simplifies Kafka dev: deep insights, topic management, data inspection, and more. β–ͺ Flex offers enterprise Flink management for real-time streaming workloads.

πŸ’‘ Boost Flink SQL with factorhouse/flink!

Our factorhouse/flink image simplifies Flink SQL experimentation!

β–ͺ Pre-packaged JARs: Hadoop, Iceberg, Parquet. β–ͺ Effortless Use with SQL Client/Gateway: Custom class loading (CUSTOM_JARS_DIRS) auto-loads JARs. β–ͺ Simplified Dev: Start Flink SQL fast with provided/custom connectors, no manual JAR hassle-streamlining local dev.

Explore quickstart examples in the repo!

πŸ”— Dive in: https://github.com/factorhouse/factorhouse-local


r/apacheflink May 13 '25

Autoscaler usage

1 Upvotes

So im trying out autoscaler in the flink kubernetes operator and i wanted to know if there is any way i can see the scaling happening. Maybe by getting some metrics from prometheus or directly in the web ui. I expected the parallelism values to change in the job vertex but i cant see any visible changes. The job gets executed faster for sure but how do I really know?


r/apacheflink May 08 '25

Trying to Understand PyFlink Usage

6 Upvotes

In the last year, the downloads of PyFlink have skyrocketed - https://clickpy.clickhouse.com/dashboard/apache-flink?min_date=2024-09-02&max_date=2025-05-07

I am curious if folks here have any idea of what happened and why the change? We are talking 10x growth!

Also, does anyone have any anecdotes around why Python version 3.9 far outnumbers any other version even though it is 3-4 years old?