rambleraptor commented on code in PR #1461:
URL: https://github.com/apache/iceberg-go/pull/1461#discussion_r3574286494


##########
catalog/rest/rest.go:
##########
@@ -2045,3 +2045,44 @@ func (r *Catalog) LoadView(ctx context.Context, 
identifier table.Identifier) (*v
 
        return view.New(identifier, metadata, rsp.MetadataLoc), nil
 }
+
+func (r *Catalog) RenameView(ctx context.Context, from, to table.Identifier) 
(*view.View, error) {
+       if err := r.endpoints.check(endpointRenameView); err != nil {
+               return nil, err
+       }
+       if err := catalog.ValidateViewIdentifier(from); err != nil {
+               return nil, err
+       }
+       if err := catalog.ValidateViewIdentifier(to); err != nil {
+               return nil, err
+       }
+
+       type payload struct {
+               Source      identifier `json:"source"`
+               Destination identifier `json:"destination"`
+       }
+       src := identifier{
+               Namespace: catalog.NamespaceFromIdent(from),
+               Name:      catalog.TableNameFromIdent(from),
+       }
+       dst := identifier{
+               Namespace: catalog.NamespaceFromIdent(to),
+               Name:      catalog.TableNameFromIdent(to),
+       }
+
+       path, err := endpointRenameView.reqPath()
+       if err != nil {
+               return nil, err
+       }
+
+       _, err = doPostAllowNoContent[payload, any](ctx, r.baseURI, path, 
payload{Source: src, Destination: dst}, r.cl,
+               map[int]error{
+                       http.StatusNotFound: catalog.ErrNoSuchView,

Review Comment:
   I'd advocate for accepting the limitation.
   
   1. It matches what RenameTable does. Consistency feels important here.
   2. It's always been unclear to me if the type field is supported by many 
REST Catalog implementations. Most of those error types aren't standardized by 
the spec and just float through from the Java implementation if I recall 
correctly.



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