Copilot commented on code in PR #9201:
URL: https://github.com/apache/gravitino/pull/9201#discussion_r2556210240


##########
lance/lance-rest-server/src/main/java/org/apache/gravitino/lance/service/rest/LanceTableOperations.java:
##########
@@ -192,6 +194,45 @@ public Response deregisterTable(
     }
   }
 
+  @POST
+  @Path("/exists")
+  @Timed(name = "table-exists." + MetricNames.HTTP_PROCESS_DURATION, absolute 
= true)
+  @ResponseMetered(name = "table-exists", absolute = true)
+  public Response tableExists(
+      @PathParam("id") String tableId,
+      @QueryParam("delimiter") @DefaultValue("$") String delimiter,
+      @Context HttpHeaders headers,
+      TableExistsRequest tableExistsRequest) {
+    try {
+      // True if exists, false if not found and other errors

Review Comment:
   The comment states "True if exists, false if not found and other errors" but 
this is misleading. The implementation returns a boolean where `false` only 
means "not found", not "other errors". Other errors would be thrown as 
exceptions and caught in the catch block at line 213. The comment should be 
corrected to "True if exists, false if not found".
   ```suggestion
         // True if exists, false if not found
   ```



##########
lance/lance-rest-server/src/main/java/org/apache/gravitino/lance/service/rest/LanceTableOperations.java:
##########
@@ -192,6 +194,45 @@ public Response deregisterTable(
     }
   }
 
+  @POST
+  @Path("/exists")
+  @Timed(name = "table-exists." + MetricNames.HTTP_PROCESS_DURATION, absolute 
= true)
+  @ResponseMetered(name = "table-exists", absolute = true)
+  public Response tableExists(
+      @PathParam("id") String tableId,
+      @QueryParam("delimiter") @DefaultValue("$") String delimiter,
+      @Context HttpHeaders headers,
+      TableExistsRequest tableExistsRequest) {
+    try {
+      // True if exists, false if not found and other errors
+      boolean exists = lanceNamespace.asTableOps().tableExists(tableId, 
delimiter);
+      if (exists) {
+        return Response.status(Response.Status.OK).build();
+      }
+      return Response.status(Response.Status.NOT_FOUND).build();
+    } catch (Exception e) {
+      return LanceExceptionMapper.toRESTResponse(tableId, e);
+    }
+  }
+
+  @POST
+  @Path("/drop")
+  @Timed(name = "drop-table." + MetricNames.HTTP_PROCESS_DURATION, absolute = 
true)
+  @ResponseMetered(name = "drop-table", absolute = true)
+  public Response dropTable(
+      @PathParam("id") String tableId,
+      @QueryParam("delimiter") @DefaultValue("$") String delimiter,
+      @Context HttpHeaders headers,
+      DeregisterTableRequest deregisterTableRequest) {
+    try {
+

Review Comment:
   [nitpick] Remove this unnecessary blank line for consistency with other 
methods in this class (e.g., `registerTable`, `deregisterTable`).
   ```suggestion
   
   ```



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