huaxingao commented on code in PR #17966:
URL: https://github.com/apache/iceberg/pull/17966#discussion_r3986305345


##########
open-api/rest-catalog-open-api.yaml:
##########
@@ -661,6 +661,59 @@ paths:
         5XX:
           $ref: '#/components/responses/ServerErrorResponse'
 
+    post:
+      tags:
+        - Catalog API
+      summary: Create a function in the given namespace
+      description:

Review Comment:
   Fixed. Thanks!



##########
open-api/rest-catalog-open-api.yaml:
##########
@@ -661,6 +661,59 @@ paths:
         5XX:
           $ref: '#/components/responses/ServerErrorResponse'
 
+    post:
+      tags:
+        - Catalog API
+      summary: Create a function in the given namespace
+      description:
+        Create a function in the given namespace.
+
+        The function is created with all of its definitions. The server 
assigns `function-uuid`,
+        `format-version`, and `definition-log`, so those must not be sent in 
the request.
+
+      operationId: createFunction
+      parameters:
+        - $ref: '#/components/parameters/idempotency-key'
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateFunctionRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/LoadFunctionResponse'
+        400:
+          $ref: '#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - The function already exists
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/IcebergErrorResponse'
+              examples:
+                FunctionAlreadyExists:
+                  $ref: '#/components/examples/FunctionAlreadyExistsError'
+        419:
+          $ref: '#/components/responses/AuthenticationTimeoutResponse'
+        503:
+          $ref: '#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '#/components/responses/ServerErrorResponse'
+
   /v1/{prefix}/namespaces/{namespace}/functions/{function}:

Review Comment:
   I agree that with no update endpoint, changing a function means dropFunction 
+ createFunction, which also mints a new function-uuid and isn't atomic. Tables 
and views avoid this because they have updateTable/replaceView.
   
   I'd still rather not put the caveat in the spec, since it goes stale once 
updateFunction lands and definition-log semantics are defined in 
format/udf-spec.md. But I'll call out in the PR description that functions have 
no in-place update yet, so drop + create is currently the only way to modify 
one and does not preserve history.



##########
open-api/rest-catalog-open-api.yaml:
##########
@@ -704,6 +757,67 @@ paths:
         5XX:
           $ref: '#/components/responses/ServerErrorResponse'
 
+    delete:
+      tags:
+        - Catalog API
+      summary: Drop a function from the catalog
+      description:
+        Remove a function from the catalog.
+
+        All definitions of the function are removed.
+
+      operationId: dropFunction
+      parameters:
+        - $ref: '#/components/parameters/idempotency-key'
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '#/components/responses/ForbiddenResponse'
+        404:
+          description:
+            Not Found - NoSuchFunctionException, function to drop does not 
exist
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/IcebergErrorResponse'
+              examples:
+                FunctionToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchFunctionError'
+        419:
+          $ref: '#/components/responses/AuthenticationTimeoutResponse'
+        503:
+          $ref: '#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '#/components/responses/ServerErrorResponse'
+
+    head:
+      tags:
+        - Catalog API
+      summary: Check if a function exists
+      description:
+        Check if a function exists within a given namespace. This request does 
not return a response body.
+      operationId: functionExists
+      responses:
+        204:
+          description: Success, no content
+        400:
+          description: Bad Request

Review Comment:
   Fixed. Thanks!



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