zeroshade commented on code in PR #240:
URL: https://github.com/apache/iceberg-go/pull/240#discussion_r1902040341


##########
catalog/rest.go:
##########
@@ -626,11 +628,76 @@ func (r *RestCatalog) LoadTable(ctx context.Context, 
identifier table.Identifier
 }
 
 func (r *RestCatalog) DropTable(ctx context.Context, identifier 
table.Identifier) error {
-       return fmt.Errorf("%w: [Rest Catalog] drop table", 
iceberg.ErrNotImplemented)
+       ns, tbl, err := splitIdentForPath(identifier)
+       if err != nil {
+               return err
+       }
+
+       _, err = doDelete[struct{}](
+               ctx,
+               r.baseURI,
+               []string{"namespaces", ns, "tables", tbl},
+               r.cl,
+               map[int]error{
+                       http.StatusNotFound: ErrNoSuchTable,
+               },
+       )
+       return err
 }
 
 func (r *RestCatalog) RenameTable(ctx context.Context, from, to 
table.Identifier) (*table.Table, error) {
-       return nil, fmt.Errorf("%w: [Rest Catalog] rename table", 
iceberg.ErrNotImplemented)
+       fromNs, fromTbl, err := splitIdentForPath(from)
+       if err != nil {
+               return nil, err
+       }
+
+       toNs, toTbl, err := splitIdentForPath(to)
+       if err != nil {
+               return nil, err
+       }
+
+       payload := map[string]interface{}{
+               "source": map[string]interface{}{
+                       "namespace": strings.Split(fromNs, namespaceSeparator),
+                       "name": fromTbl,
+               },
+               "destination": map[string]interface{}{
+                       "namespace": strings.Split(toNs, namespaceSeparator),
+                       "name": toTbl,
+               },
+       }

Review Comment:
   any reason not to create a struct for this instead of the maps?
   



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to