singhpk234 commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3454826458


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document 
describing
+        datasets, fields, relationships, metrics, and AI context for a logical 
analytics surface above
+        physical tables and views.

Review Comment:
   ```suggestion
           physical tables and views under same namespace .
   ```



##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document 
describing
+        datasets, fields, relationships, metrics, and AI context for a logical 
analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already 
exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  
/polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+components:
+  parameters:
+    semantic-model-name:
+      name: semantic-model-name
+      in: path
+      required: true
+      schema:
+        $ref: '#/components/schemas/SemanticModelName'
+
+  schemas:
+
+    SemanticModelName:
+      type: string
+      description:
+        A semantic model name. A valid name consists of uppercase and 
lowercase letters (A-Z, a-z),
+        digits (0-9), hyphens (-), and underscores (_).
+      pattern: '^[A-Za-z0-9\-_]+$'
+      example: 'tpcds_retail_model'
+
+    SemanticModelDocument:
+      type: object
+      description: An Open Semantic Interchange (OSI) document body.
+      required:
+        - version
+        - semantic_model
+      properties:
+        version:
+          type: string
+          description: The OSI spec version.
+          example: "0.1.1"
+        semantic_model:
+          type: string
+          description: The OSI semantic model serialized as a JSON string.
+      example:
+        version: "0.1.1"
+        semantic_model: '{"name":"tpcds_retail_model","description":"retail 
analytics","datasets":[{"name":"store_sales","source":"public.store_sales","primary_key":["ss_item_sk","ss_ticket_number"]}],"metrics":[{"name":"total_sales","expression":{"dialects":[{"dialect":"ANSI_SQL","expression":"SUM(ss_ext_sales_price)"}]}}]}'
+
+    SemanticModelIdentifier:
+      type: object
+      required:
+        - namespace
+        - name
+      properties:
+        namespace:
+          $ref: 
'../iceberg-rest-catalog-open-api.yaml#/components/schemas/Namespace'
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+
+    CreateSemanticModelRequest:
+      type: object
+      required:
+        - name
+        - document
+      properties:
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+
+    UpdateSemanticModelRequest:

Review Comment:
   How are we planning to handle to concurrent updates ? 
   what if we expose a entityVersion in this response to achieve OCC ? in this 
way polaris client would just expect to sent this entityVersion and CAS only 
succeeds when its eq to version sent ? 
   
   much like what Glue did for supporting non irc spec impl 



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

Reply via email to