mchades commented on code in PR #9016:
URL: https://github.com/apache/gravitino/pull/9016#discussion_r2492651179


##########
lance/lance-common/src/main/java/org/apache/gravitino/lance/common/ops/gravitino/GravitinoLanceNamespaceWrapper.java:
##########
@@ -596,7 +598,7 @@ public CreateTableResponse createTable(
         break;
       case OVERWRITE:
         if (catalog.asTableCatalog().tableExists(tableIdentifier)) {

Review Comment:
   if code reach here, `catalog.asTableCatalog().tableExists` will be called 
three times



##########
catalogs/catalog-generic-lakehouse/src/main/java/org/apache/gravitino/catalog/lakehouse/lance/LanceCatalogOperations.java:
##########


Review Comment:
   should you also pass the storage options of the table?



##########
lance/lance-common/src/main/java/org/apache/gravitino/lance/common/ops/gravitino/GravitinoLanceNamespaceWrapper.java:
##########
@@ -607,21 +609,28 @@ public CreateTableResponse createTable(
         catalog
             .asTableCatalog()
             .createTable(
-                tableIdentifier,
-                columns.toArray(new Column[0]),
-                tableLocation,
-                createTableProperties);
+                tableIdentifier, columns.toArray(new Column[0]), null, 
createTableProperties);
 
     CreateTableResponse response = new CreateTableResponse();
     response.setProperties(t.properties());
     response.setLocation(tableLocation);
+    // We have removed the prefix "lance.storage" from the table properties 
for storage options. So
+    // here we need to add it back.

Review Comment:
   I'm confused about this comment, where did we remove the prefix 
"lance.storage" from the table properties?



##########
lance/lance-common/src/main/java/org/apache/gravitino/lance/common/ops/LanceTableOperations.java:
##########
@@ -18,26 +18,66 @@
  */
 package org.apache.gravitino.lance.common.ops;
 
+import com.lancedb.lance.namespace.model.CreateTableRequest;
 import com.lancedb.lance.namespace.model.CreateTableResponse;
 import com.lancedb.lance.namespace.model.DeregisterTableResponse;
 import com.lancedb.lance.namespace.model.DescribeTableResponse;
+import com.lancedb.lance.namespace.model.RegisterTableRequest;
 import com.lancedb.lance.namespace.model.RegisterTableResponse;
 import java.util.Map;
 
 public interface LanceTableOperations {
 
-  DescribeTableResponse describeTable(String tableId, String delimiter);
+  /**
+   * Describe the details of a table.
+   *
+   * @param tableId table ids are in the format of 
"{namespace}{delimiter}{table_name}"
+   * @param delimiter the delimiter used in the namespace
+   * @param version the version of the table to describe, if null, describe 
the latest version
+   * @return the table description
+   */
+  DescribeTableResponse describeTable(String tableId, String delimiter, Long 
version);
 
+  /**
+   * Create a new table.
+   *
+   * @param tableId table ids are in the format of 
"namespace/delimiter/table_name"
+   * @param mode it can be CREATE, OVERWRITE, or EXIST_OK
+   * @param delimiter the delimiter used in the namespace
+   * @param tableLocation the location where the table data will be stored
+   * @param tableProperties the properties of the table
+   * @param arrowStreamBody the arrow stream bytes containing the schema and 
data
+   * @return the response of the create table operation
+   */
   CreateTableResponse createTable(
       String tableId,
-      String mode,
+      CreateTableRequest.ModeEnum mode,
       String delimiter,
       String tableLocation,
       Map<String, String> tableProperties,
       byte[] arrowStreamBody);
 
+  /**
+   * Register an existing table.
+   *
+   * @param tableId table ids are in the format of 
"namespace/delimiter/table_name"
+   * @param mode it can be REGISTER or OVERWRITE.
+   * @param delimiter the delimiter used in the namespace
+   * @param tableProperties the properties of the table, it should contain the 
table location
+   * @return

Review Comment:
   miss comment



##########
lance/lance-common/src/main/java/org/apache/gravitino/lance/common/ops/gravitino/GravitinoLanceNamespaceWrapper.java:
##########
@@ -673,7 +681,14 @@ public DeregisterTableResponse deregisterTable(String 
tableId, String delimiter)
     Table t = catalog.asTableCatalog().loadTable(tableIdentifier);
     Map<String, String> properties = t.properties();
     // TODO Support real deregister API.
-    catalog.asTableCatalog().purgeTable(tableIdentifier);
+    boolean result = catalog.asTableCatalog().dropTable(tableIdentifier);
+    if (!result) {
+      throw LanceNamespaceException.notFound(
+          "Table not found: " + tableId,
+          NoSuchSchemaException.class.getSimpleName(),

Review Comment:
   wrong class



##########
catalogs/catalog-generic-lakehouse/src/main/java/org/apache/gravitino/catalog/lakehouse/lance/LanceCatalogOperations.java:
##########


Review Comment:
   What if the `Dataset.drop` failed?



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