Migrating from Flink SQL
Flink SQL is a streaming SQL dialect with continuous queries over unbounded tables. ArkFlow's SQL is DataFusion: the processor runs one query per Arrow batch. That single difference explains most of the migration work.
The core difference: per-batch vs continuous
| Flink SQL | ArkFlow sql processor | |
|---|---|---|
| Query mode | Continuous: stateful operators over unbounded input | Per batch: stateless query over one MessageBatch |
| Aggregations | Maintained incrementally, emit updates | Computed within the batch; use windows/jobs for continuous aggregates |
| Joins | Stream-stream joins with state retention | Batch-internal joins, or the Job DAG keyed interval join |
| Watermarks | Declared on tables, drive windows | Declared on Job sources (see event time) |
GROUP BY without window | Continuous stateful aggregation | Aggregates the batch only |
A Flink query like SELECT user, COUNT(*) FROM orders GROUP BY user is a
continuous aggregation. In ArkFlow the equivalent is a Job with event-time
windows (or a session window buffer) whose window output can then be SQL-shaped
— see the windowed aggregation recipe.
What translates directly
SELECT/WHERE/ORDER BY/LIMITprojections and filters.- Expressions,
CAST, string/date functions (DataFusion function set; check the function reference for names). JOINs between the batch and atemporarydimension table (see temporal join cookbook).- Window functions over the batch (
row_number,lag,lead— see the cookbook patterns).
What needs a redesign
| Flink SQL feature | ArkFlow equivalent |
|---|---|
Continuous GROUP BY aggregation | Job event-time window + aggregation |
| Stream-stream interval join | Job DAG keyed interval join |
MATCH_RECOGNIZE / CEP | Not supported; express with chained processors or a custom plugin |
| Flink UDFs (Java/Scala) | Python or VRL processor |
| Exactly-once checkpoints (2PC sinks) | Transactional Kafka output / idempotent sinks (see exactly-once) |
Watermarks and allowed lateness
Flink declares watermarks per table (WATERMARK FOR ts AS ts - INTERVAL '5' SECOND). ArkFlow declares them per Job source:
sources:
- operator_id: orders
input_type: kafka
config:
type: kafka
brokers: ["localhost:9092"]
topics: ["orders"]
consumer_group: orders-fleet
start_from_latest: false
codec:
type: json
time:
mode: event_time
timestamp_field: ts
watermark:
strategy: bounded_out_of_orderness
out_of_orderness_ms: 5000
idle_timeout_ms: 60000
Late policies (drop / route / update) and allowed lateness are declared
next to the watermark — see
event time and watermarks.
Verification
- Run the Flink job and the ArkFlow job over the same replay window; compare window outputs (counts and sums per window boundary).
- Test a late event: confirm the declared policy fires as expected.
- Load-test the batch path; per-batch SQL is stateless, so throughput scales
with
thread_numwhere Flink scales with parallelism.