kevinjqliu commented on code in PR #14940:
URL: https://github.com/apache/iceberg/pull/14940#discussion_r2673328483


##########
bigquery/src/main/java/org/apache/iceberg/gcp/bigquery/BigQueryTableOperations.java:
##########
@@ -149,9 +155,15 @@ private void addConnectionIfProvided(Table tableBuilder, 
Map<String, String> met
   }
 
   /** Update table properties with concurrent update detection using etag. */
-  private void updateTable(
-      String oldMetadataLocation, String newMetadataLocation, TableMetadata 
metadata) {
-    Table table = client.load(tableReference);
+  private void updateTable(String newMetadataLocation, TableMetadata metadata) 
{
+    Table table = this.refreshedTable;
+    if (table == null) {
+      LOG.warn("Table not set from doRefresh() for {}, loading from BigQuery", 
tableName());
+      table = client.load(tableReference);
+    }
+
+    this.refreshedTable = null;

Review Comment:
   this feels like an anti-pattern to me, and should not live in `updateTable`. 
i think we should separate concerns for table refresh and update. 
   Looking at 
[JdbcTableOperations](https://github.com/apache/iceberg/blob/cde5b9f984344d134fc907b2ff3883499d7e54c3/core/src/main/java/org/apache/iceberg/jdbc/JdbcTableOperations.java#L114-L116),
 `updateTable` should just be an atomic operation.
   
   



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