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


##########
catalog/rest.go:
##########
@@ -710,3 +777,54 @@ func (r *RestCatalog) UpdateNamespaceProperties(ctx 
context.Context, namespace t
        return doPost[payload, PropertiesUpdateSummary](ctx, r.baseURI, 
[]string{"namespaces", ns, "properties"},
                payload{Remove: removals, Updates: updates}, r.cl, 
map[int]error{http.StatusNotFound: ErrNoSuchNamespace})
 }
+
+func (r *RestCatalog) CreateTable(ctx context.Context, identifier 
table.Identifier, schema *iceberg.Schema, 
+       partition iceberg.PartitionSpec, location string, props 
iceberg.Properties) (*table.Table, error) {
+       
+       ns, tbl, err := splitIdentForPath(identifier)
+       if err != nil {
+               return nil, err
+       }
+
+       payload := map[string]interface{}{
+               "name": tbl,
+               "location": location,
+               "schema": schema,
+               "partition-spec": partition,
+               "properties": props,
+               "stage-create": false,
+       }
+
+       ret, err := doPost[map[string]interface{}, tblResponse](
+               ctx,
+               r.baseURI,
+               []string{"namespaces", ns, "tables"},
+               payload,
+               r.cl,
+               map[int]error{
+                       http.StatusNotFound: ErrNoSuchNamespace,
+                       http.StatusConflict: ErrTableAlreadyExists,
+               },
+       )
+       if err != nil {
+               return nil, err
+       }
+
+       id := identifier
+       if r.name != "" {
+               id = append([]string{r.name}, identifier...)
+       }
+
+       tblProps := maps.Clone(r.props)
+       maps.Copy(tblProps, props)
+       maps.Copy(tblProps, ret.Metadata.Properties())
+       for k, v := range ret.Config {
+               tblProps[k] = v
+       }

Review Comment:
   `maps.Copy(tblProps, ret.Config)`?



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