leaves12138 commented on code in PR #497:
URL: https://github.com/apache/paimon-rust/pull/497#discussion_r3560318489
##########
crates/integrations/datafusion/src/sql_context.rs:
##########
@@ -1514,6 +1569,72 @@ impl SQLContext {
}
}
+fn validate_persistent_create_view(create_view: &CreateView) -> DFResult<()> {
+ let unsupported = if create_view.or_alter {
+ Some("CREATE OR ALTER VIEW is not supported")
+ } else if create_view.or_replace {
+ Some("CREATE OR REPLACE VIEW is not supported")
+ } else if create_view.secure {
Review Comment:
Please reject `COPY GRANTS` here as well and add it to the
unsupported-clause regression cases. `sqlparser::ast::CreateView` exposes this
modifier through `copy_grants`, but the current validator never checks it, so
`CREATE VIEW ... COPY GRANTS AS SELECT ...` succeeds while silently dropping
the requested grant-copy semantics. This also contradicts the documentation
that vendor-specific modifiers are unsupported.
##########
crates/paimon/src/catalog/rest/rest_catalog.rs:
##########
@@ -278,6 +278,22 @@ impl Catalog for RESTCatalog {
})
}
+ async fn create_view(
+ &self,
+ identifier: &Identifier,
+ schema: crate::catalog::ViewSchema,
+ ignore_if_exists: bool,
+ ) -> Result<()> {
+ let result = self
+ .api
+ .create_view(identifier, schema)
+ .await
+ .map_err(|error| map_rest_error_for_view(error, identifier));
Review Comment:
The create operation needs an operation-specific 404 mapping. For `POST
/databases/{db}/views`, HTTP 404 means the parent database does not exist, but
`map_rest_error_for_view` converts it to `Error::ViewNotExist`. Java
`RESTCatalog.createView` maps the same response to `DatabaseNotExistException`.
Please preserve that contract here and add a missing-database test.
--
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]