Databricks iconDatabricksSep 14, 2026 ~7 min source read

On-demand state repartitioning for Spark Structured Streaming on Databricks

Databricks now lets you change the partition count for long-running stateful Structured Streaming queries without rebuilding checkpoints or losing state, using RocksDB and a new config that redistributes state safely on restart.

Announcing On-Demand State Repartitioning for Apache Sparkâ„¢ Structured Streaming on Databricks

Share this story

Send the public story page.

Useful takeaways from this story.

You can resize partitions for stateful Structured Streaming queries without discarding checkpoints by using Databricks Runtime 18+ with the RocksDB state store.

This applies to all stateful operations (aggregations, joins, deduplication, sessionization, transformWithState) and helps right-size streams as data volumes change.

Early users report operational savings—Coveo cut Amazon S3 API costs by 40% after adopting on-demand repartitioning.

On-demand state repartitioning (Public Preview) in Databricks Runtime 18+ removes that constraint. You can change the number of state partitions and keep the existing checkpointed state. The feature redistributes the state on disk to match the new partition count so the hashing and layout line up after a restart.

Requirements are short and concrete: run Databricks Runtime 18 or later and use the RocksDB state store provider. Databricks set RocksDB as the default state store on DBR 17.3+, so most new stateful queries will already use it.

The operation follows a familiar pattern: stop the streaming query, set a dedicated configuration, and restart. Specifically, set spark.sql.streaming.stateStore.partitions to your desired partition count and restart the query. For stateful queries, spark.sql.streaming.stateStore.partitions takes precedence over spark.sql.shuffle.partitions. On restart, Structured Streaming physically redistributes the RocksDB-backed state files to match the new partition layout so existing keys remain discoverable by the query.

  • Tune long-running streams without checkpoint rebuilds. If your initial partitioning becomes a bottleneck as data grows, you can resize to reduce skew and hot partitions.
  • Scale resource usage to workload patterns. Shrink or expand partition count as traffic falls or spikes to better match compute and storage characteristics.
  • Apply to any stateful operation: aggregations, stream-stream joins, deduplication, session windowing, and transformWithState.

1) Confirm your cluster runs Databricks Runtime 18 or later. 2) Verify RocksDB is the state store (default on DBR 17.3+). 3) Stop the stateful streaming query you want to resize. 4) Set spark.sql.streaming.stateStore.partitions to the target partition count. 5) Restart the query and monitor query progress metrics to confirm the repartition operation completed and the new partition layout is in use.

The repartitioning operation physically moves state files to match the new layout, so monitor query progress and metrics during the restart. The blog emphasizes that the mechanism is designed to be safe: it preserves existing state rather than ignoring updated settings, avoiding silent state corruption.

On-demand state repartitioning removes the long-standing operational trade-off for stateful Structured Streaming: you no longer must choose between overprovisioning and rebuilding checkpoints when traffic changes. If you run stateful streaming at scale on Databricks, enable the RocksDB state store and use spark.sql.streaming.stateStore.partitions to right-size your streams without losing accumulated state.

More context around this story.

What’s new with Google Data Cloud
Google iconGoogleSep 3, 2026

What’s new with Google Data Cloud

August 31 - September 4 Stateful processing is available in BigQuery continuous queries in Preview Stateful operations significantly expand what’s possible with BigQuery continuous queries. This feature allows users to leverage functions like JOIN s, aggregations, and windowing functions directly in their streaming que

dbt Meets Apache Flink: One Workflow for Data Engineers
Dzone iconDzoneSep 15, 2026

dbt Meets Apache Flink: One Workflow for Data Engineers

Data engineers managing batch SQL pipelines on Snowflake, BigQuery, and increasingly Databricks, and streaming pipelines on Apache Flink face a familiar problem: two toolchains, two skill sets, two CI/CD pipelines.dbt is now extending into stream processing. This post explains what that means in practice, why it matter

Loading more related stories...

Keep reading in the app

Open the app view to save this story, compare related coverage, and continue from the same source.

Open in app