Data FlowData Flow
DataFlow
  • User Manual
  • Developer Manual
  • Examples
  • API Reference
Overview
Getting Started
Pipeline Authoring
Execution
    Execution LifecycleBatch vs StreamCheckpoints and OffsetsSchedules
Deployment
Troubleshooting
Examples
Execution

Batch vs Stream

The spec's mode declares intent - but what actually makes a pipeline streaming is a type: stream source (or MongoDB change streams). Everything else works the same in both modes; the difference is how frames are read, written, and kept alive.

At a glance

  • mode declares intent - a type: stream source (or MongoDB change streams) is what actually makes a pipeline streaming.
  • Batch - one pass to completion, positions from asset offsets, commits when the run succeeds.
  • Stream - continuous micro-batches, runs until killed, positions and state carried by Spark checkpoints.

The two modes

batchstream
ReadsOne pass to completionContinuous micro-batches
WritesDirect writes per outputforeachBatch micro-batches
Run lifetimeStarts and finishesRuns until killed
PositionAsset offset watermarksSpark checkpoints
Stateful stepsParquet state per stepSpark checkpointed state
SchedulingFire and finishOne live run at a time

Batch

Batch runs are one-shot: read everything past the offsets, process, write, commit, done.

  • Incremental reads come from asset offsets - a WHERE key > value watermark per asset, committed only after the run succeeds
  • Stateful steps (aggregate, forward_fill, gap_fill) keep cross-run state in Parquet files, committed after destinations succeed
  • Schedules fit naturally: the scheduler fires a run, it finishes, the next one waits
Code
pipeline: nightly_orders mode: batch # sources → builds → transforms → destinations, run to completion

A batch pipeline can still write to a stream - e.g. publish rows to a Kafka topic (type: stream destination) as part of the run. The write is direct, not continuous.

Stream

A pipeline becomes streaming when a source reads continuously - a stream source (Kafka, Redis, Kinesis, SQS) or MongoDB change streams:

Code
sources: - name: orders_topic type: stream provider: kafka settings: url: broker:9093 auth: security_protocol: SASL_PLAINTEXT sasl_mechanism: PLAIN user: pipeline password: pipeline-secret assets: - name: orders topic: orders options: starting_offsets: latest

Streaming behavior:

  • Outputs write micro-batch by micro-batch - per-output options: trigger_interval (e.g. "10 seconds"), output_mode (append default; update; complete is coerced to append)
  • Ingestion is throttled per asset - e.g. Kafka max_offsets_per_trigger, Kinesis max_fetch_records_per_shard
  • Aggregates become windowed with state.window (tumbling / session) or running totals without it
  • The engine keeps the run alive: streaming queries are awaited, so the run stays RUNNING until killed
  • Spark checkpoints carry source positions and stateful state across restarts - kill the run, start it again, and it resumes from the checkpoint

Stream sources never use asset offset or chain - their position lives in the checkpoint, not the offsets table.

Choosing

You needUse
Scheduled loads, incremental watermarksbatch
Continuous, low-latency ingestionstream
Cross-run accumulating aggregates, bounded historybatch + stateful steps
Rolling windows, live dashboardsstream + state.window
Publish a batch result to a topicbatch + stream destination
Exactly-once where the sink allowsstream + idempotent sink (e.g. JDBC upsert)

Practical notes:

  • A scheduled pipeline with a RUNNING run is skipped until it finishes - long-running stream pipelines and cron schedules don't mix; start stream pipelines on demand
  • Restarts resume from checkpoints, but missed time is not replayed - a schedule that came due while the app was down runs once, then advances
  • Both modes report the same stages, lineage, samples, and logs - see Execution Lifecycle

Related pages

  • Execution Lifecycle - statuses, stages, reconciliation
  • Checkpoints and Offsets - positions and state in depth
  • Sources - stream sources and their options
  • Destinations - streaming output options
  • Transforms - windowed and running aggregates
Suggest edit
Last modified on November 26, 2026
Execution LifecycleCheckpoints and Offsets
On this page
  • At a glance
  • The two modes
  • Batch
  • Stream
  • Choosing
  • Related pages
YAML
YAML