jerryshao commented on code in PR #9127:
URL: https://github.com/apache/gravitino/pull/9127#discussion_r2709607901


##########
catalogs/catalog-lakehouse-generic/src/main/java/org/apache/gravitino/catalog/lakehouse/lance/LanceTableOperations.java:
##########
@@ -303,11 +287,41 @@ private org.apache.arrow.vector.types.pojo.Schema 
convertColumnsToArrowSchema(Co
     return new org.apache.arrow.vector.types.pojo.Schema(fields);
   }
 
-  private void addLanceIndex(Table table, List<Index> addedIndexes) {
+  // Note: this method can't guarantee the atomicity of the operations on 
Lance dataset. For
+  // example, only a subset of changes may be applied if an exception occurs 
during the process.
+  private void handleLanceTableChange(Table table, TableChange[] changes) {
+    List<String> dropColumns = Lists.newArrayList();
+    List<Index> indexToAdd = Lists.newArrayList();
+    List<ColumnAlteration> renameColumns = Lists.newArrayList();
+
+    for (TableChange change : changes) {
+      if (change instanceof TableChange.DeleteColumn deleteColumn) {
+        dropColumns.add(deleteColumn.fieldName()[0]);
+      } else if (change instanceof TableChange.AddIndex addIndex) {
+        indexToAdd.add(
+            Indexes.IndexImpl.builder()
+                .withIndexType(addIndex.getType())
+                .withName(addIndex.getName())
+                .withFieldNames(addIndex.getFieldNames())
+                .build());
+      } else if (change instanceof TableChange.RenameColumn renameColumn) {
+        // Currently, only renaming columns is supported.
+        // TODO: Support change column type once we have a clear knowledge 
about the means of
+        // castTo in Lance.
+        ColumnAlteration lanceColumnAlter =
+            new ColumnAlteration.Builder(renameColumn.fieldName()[0])

Review Comment:
   Also here.



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