shrirangmhalgi opened a new pull request, #56319:
URL: https://github.com/apache/spark/pull/56319

   
   
   ### What changes were proposed in this pull request?
   Make `StateDataSource` and `StateMetadataSource` explicitly reject write 
operations with a clear error message (`STDS_WRITE_UNSUPPORTED`) instead of 
falling through to the V1 write path and producing a confusing internal error.
   
   Both sources now implement `CreatableRelationProvider` and throw immediately 
in `createRelation`, producing: "The state data source 'statestore' is 
read-only and does not support write operations."
   
   
   ### Why are the changes needed?
   `StateDataSource` (statestore) and `StateMetadataSource` (state-metadata) 
are read-only checkpoint inspection sources. Previously, 
`df.write.format("statestore").save()` fell through to the V1 write path and 
threw `INTERNAL_ERROR: "does not allow create table as select"` - a confusing 
message that doesn't tell the user the source is intentionally read-only.
   
   
   ### Does this PR introduce _any_ user-facing change?
   Yes. Write attempts on state data sources now produce a clear error:
   
   ```
   [STDS_WRITE_UNSUPPORTED] The state data source 'statestore' is read-only and 
does not support write operations. State store checkpoint data should not be 
modified externally.
   ```
   
   Previously the error was a generic internal error.
   
   
   ### How was this patch tested?
   Added 2 tests in `StateDataSourceNegativeTestSuite` verifying that 
`df.write.format("statestore").save()` and 
`df.write.format("state-metadata").save()` throw `STDS_WRITE_UNSUPPORTED` with 
sqlState `0A000`.
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   Yes. Using Claude-Opus 4.6


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to