Skip to content

Conversation

@liviazhu
Copy link
Contributor

What changes were proposed in this pull request?

Add an error if stateful operators are in the query plan but state directory is empty.

Why are the changes needed?

Without this explicit error, user will see CANNOT_LOAD_STATE_STORE.CANNOT_READ_STREAMING_STATE_FILE which is confusing and could be mistaken for an internal error.

Does this PR introduce any user-facing change?

Yes, error message will change from CANNOT_LOAD_STATE_STORE.CANNOT_READ_STREAMING_STATE_FILE to STREAMING_STATEFUL_OPERATOR_MISSING_STATE_DIRECTORY

How was this patch tested?

New unit tests

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude 4.5

@liviazhu liviazhu changed the title [SPARK-54307] [SS] Throw an error if streaming query is restarted with stateful op but empty state dir [SPARK-54307] [SS] Throw an error if streaming query is restarted with stateful op but there is empty state dir Nov 11, 2025
Copy link
Contributor

@anishshri-db anishshri-db left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm pending green CI

zifeif2 pushed a commit to zifeif2/spark that referenced this pull request Nov 22, 2025
… stateful op but there is empty state dir

### What changes were proposed in this pull request?

Add an error if stateful operators are in the query plan but state directory is empty.

### Why are the changes needed?

Without this explicit error, user will see CANNOT_LOAD_STATE_STORE.CANNOT_READ_STREAMING_STATE_FILE which is confusing and could be mistaken for an internal error.

### Does this PR introduce _any_ user-facing change?

Yes, error message will change from `CANNOT_LOAD_STATE_STORE.CANNOT_READ_STREAMING_STATE_FILE` to `STREAMING_STATEFUL_OPERATOR_MISSING_STATE_DIRECTORY`

### How was this patch tested?

New unit tests

### Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude 4.5

Closes apache#53007 from liviazhu/liviazhu-db/empty-state-dir-error.

Authored-by: Livia Zhu <livia.zhu@databricks.com>
Signed-off-by: Anish Shrigondekar <anish.shrigondekar@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants