ebyhr commented on code in PR #14159:
URL: https://github.com/apache/iceberg/pull/14159#discussion_r2517063202


##########
bigquery/src/main/java/org/apache/iceberg/gcp/bigquery/BigQueryMetastoreClientImpl.java:
##########
@@ -527,6 +531,76 @@ public List<Tables> list(DatasetReference 
datasetReference, boolean listAllTable
     }
   }
 
+  @Override
+  public void rename(TableReference fromTableReference, TableReference 
toTableReference) {
+    try {
+      Table sourceTable = load(fromTableReference);
+
+      DatasetReference toDatasetReference =
+          new DatasetReference()
+              .setProjectId(toTableReference.getProjectId())
+              .setDatasetId(toTableReference.getDatasetId());
+      load(toDatasetReference);
+
+      Table renamedTable = new Table();
+      renamedTable.setTableReference(toTableReference);
+      
renamedTable.setExternalCatalogTableOptions(sourceTable.getExternalCatalogTableOptions());

Review Comment:
   I've recently tested BigLake metastore, and noticed it requires that the 
location must contain the table name. Does this BigQuery metastore have the 
same requirement? 



##########
bigquery/src/main/java/org/apache/iceberg/gcp/bigquery/BigQueryMetastoreClientImpl.java:
##########
@@ -527,6 +531,76 @@ public List<Tables> list(DatasetReference 
datasetReference, boolean listAllTable
     }
   }
 
+  @Override
+  public void rename(TableReference fromTableReference, TableReference 
toTableReference) {
+    try {
+      Table sourceTable = load(fromTableReference);
+
+      DatasetReference toDatasetReference =
+          new DatasetReference()
+              .setProjectId(toTableReference.getProjectId())
+              .setDatasetId(toTableReference.getDatasetId());
+      load(toDatasetReference);
+
+      Table renamedTable = new Table();
+      renamedTable.setTableReference(toTableReference);
+      
renamedTable.setExternalCatalogTableOptions(sourceTable.getExternalCatalogTableOptions());
+
+      createNewTableDuringRename(toTableReference, renamedTable);
+      deleteOriginalTableDuringRename(fromTableReference, toTableReference);

Review Comment:
   Does BigQuery preserve existing permissions even after drop & create? 



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to