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

   ### What changes were proposed in this pull request?
   
   This PR adds a partial-update API for catalog views:
   
   - Add `ViewChange` with ordered `SetProperty` and `RemoveProperty` changes.
   - Add `ViewCatalog.alterView(Identifier, ViewChange...)`.
   - Provide a backward-compatible default that loads the latest view, applies 
the changes while preserving all typed view metadata, and calls `replaceView`.
   - Route `ALTER VIEW ... SET TBLPROPERTIES` and `ALTER VIEW ... UNSET 
TBLPROPERTIES` through one `alterView` change batch.
   - Keep full metadata operations such as `ALTER VIEW ... AS` and 
schema-binding changes on `replaceView`.
   
   Catalogs can override `alterView` to translate the full ordered batch into a 
native atomic update.
   
   ### Why are the changes needed?
   
   The current V2 property ALTER executors rebuild a complete `View` from 
metadata captured during analysis and call `replaceView`. That prevents 
connectors from applying native property validation and atomic partial updates, 
and a full replacement can overwrite unrelated metadata changed concurrently.
   
   A `ViewChange` API, analogous to `TableChange`, gives connectors the 
requested operation instead of a reconstructed full view. The default 
implementation preserves compatibility for existing `ViewCatalog` 
implementations.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. This adds an evolving connector API for partial view updates. Existing 
catalogs remain compatible through the default implementation, and SQL 
SET/UNSET behavior is unchanged. Catalogs that override `alterView` can provide 
native validation and atomic update semantics.
   
   ### How was this patch tested?
   
   - `build/sbt catalyst/Test/compile`
   - `build/sbt sql/Test/compile`
   - `build/sbt 'catalyst/testOnly 
org.apache.spark.sql.connector.catalog.ViewCatalogSuite'`
   - `SPARK_LOCAL_IP=127.0.0.1 SPARK_LOCAL_HOSTNAME=localhost build/sbt 
'sql/testOnly 
org.apache.spark.sql.execution.command.v2.AlterViewSetTblPropertiesSuite 
org.apache.spark.sql.execution.command.v2.AlterViewUnsetTblPropertiesSuite'`
   - `build/sbt catalyst/checkstyle catalyst/scalastyle 
catalyst/Test/scalastyle sql/scalastyle sql/Test/scalastyle`
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Codex (GPT-5)
   


-- 
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