FANNG1 commented on code in PR #5584:
URL: https://github.com/apache/gravitino/pull/5584#discussion_r1843314635


##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/rest/IcebergViewOperations.java:
##########
@@ -139,11 +185,49 @@ public Response viewExists(
       @PathParam("prefix") String prefix,
       @PathParam("namespace") String namespace,
       @PathParam("view") String view) {
-    TableIdentifier tableIdentifier = 
TableIdentifier.of(RESTUtil.decodeNamespace(namespace), view);
-    if 
(icebergCatalogWrapperManager.getOps(prefix).existView(tableIdentifier)) {
-      return IcebergRestUtils.noContent();
+    String catalogName = IcebergRestUtils.getCatalogName(prefix);
+    Namespace icebergNS = RESTUtil.decodeNamespace(namespace);
+    LOG.info(
+        "Check Iceberg view exists, catalog: {}, namespace: {}, table: {}",
+        catalogName,
+        icebergNS,
+        view);
+    IcebergRequestContext context = new 
IcebergRequestContext(httpServletRequest(), catalogName);
+    TableIdentifier viewIdentifier = TableIdentifier.of(icebergNS, view);
+    boolean exists = viewOperationDispatcher.viewExists(context, 
viewIdentifier);
+    if (exists) {
+      return IcebergRestUtils.okWithoutContent();
     } else {
       return IcebergRestUtils.notExists();
     }
   }
+
+  @POST
+  @Path("{view}/metrics")
+  @Produces(MediaType.APPLICATION_JSON)
+  @Timed(name = "report-view-metrics." + MetricNames.HTTP_PROCESS_DURATION, 
absolute = true)
+  @ResponseMetered(name = "report-table-metrics", absolute = true)
+  public Response reportTableMetrics(

Review Comment:
   Gravitino Iceberg REST server follows Iceberg REST API spec,  there are 
table metrics interfaces, seems no view metrics .  
https://github.com/apache/iceberg/blob/main/open-api/rest-catalog-open-api.yaml#L1262



##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergCreateViewEvent.java:
##########
@@ -0,0 +1,54 @@
+/*
+ *  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.
+ */
+
+package org.apache.gravitino.listener.api.event;
+
+import org.apache.gravitino.NameIdentifier;
+import org.apache.gravitino.annotation.DeveloperApi;
+import org.apache.gravitino.iceberg.service.IcebergRestUtils;
+import org.apache.iceberg.rest.requests.CreateViewRequest;
+import org.apache.iceberg.rest.responses.LoadViewResponse;
+
+/** Represent an event after creating Iceberg view successfully. */
+@DeveloperApi
+public class IcebergCreateViewEvent extends IcebergViewEvent {
+
+  private CreateViewRequest createViewRequest;

Review Comment:
   add final?



##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergViewFailureEvent.java:
##########
@@ -0,0 +1,32 @@
+/*
+ *  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.
+ */
+
+package org.apache.gravitino.listener.api.event;
+
+import org.apache.gravitino.NameIdentifier;
+import org.apache.gravitino.annotation.DeveloperApi;
+
+/** Represent a failure event when do Iceberg view operation failed. */
+@DeveloperApi
+public class IcebergViewFailureEvent extends IcebergFailureEvent {

Review Comment:
   could you make this class abstract? and make `IcebergTableFailureEvent` to 
abstract class too?



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