lishuxu commented on code in PR #152:
URL: https://github.com/apache/iceberg-cpp/pull/152#discussion_r2268510058


##########
src/iceberg/table.cc:
##########
@@ -21,16 +21,36 @@
 
 #include <algorithm>
 
+#include "iceberg/catalog.h"
 #include "iceberg/partition_spec.h"
 #include "iceberg/schema.h"
 #include "iceberg/sort_order.h"
 #include "iceberg/table_metadata.h"
 #include "iceberg/table_scan.h"
+#include "iceberg/util/macros.h"
 
 namespace iceberg {
 
 const std::string& Table::uuid() const { return metadata_->table_uuid; }
 
+Status Table::Refresh() {
+  if (!catalog_) {
+    return NotSupported("Refresh is not supported for table without a 
catalog");
+  }
+
+  ICEBERG_ASSIGN_OR_RAISE(auto refreshed_table, 
catalog_->LoadTable(identifier_));
+  if (metadata_location_ != refreshed_table->metadata_location_) {
+    metadata_ = std::move(refreshed_table->metadata_);
+    metadata_location_ = std::move(refreshed_table->metadata_location_);
+    io_ = std::move(refreshed_table->io_);
+
+    schemas_map_.reset();
+    partition_spec_map_.reset();
+    sort_orders_map_.reset();

Review Comment:
   Because this information is lazily initialized in the table, and the 
refreshed table hasn’t initialized these objects either, so a reset is 
sufficient.



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to