wgtmac commented on code in PR #281:
URL: https://github.com/apache/iceberg-cpp/pull/281#discussion_r2509283337


##########
src/iceberg/transaction.h:
##########
@@ -42,12 +44,23 @@ class ICEBERG_EXPORT Transaction {
   /// \return a new AppendFiles
   virtual std::shared_ptr<AppendFiles> NewAppend() = 0;
 
+  /// \brief Apply multiple metadata updates to this transaction
+  ///
+  /// \param requirements the table requirements to validate
+  /// \param updates the table updates to apply
+  /// \return Status::OK if all updates were queued successfully
+  virtual Status UpdateTable(
+      const std::vector<std::unique_ptr<TableRequirement>>& requirements,
+      std::vector<std::unique_ptr<TableUpdate>> updates) = 0;

Review Comment:
   ```suggestion
         const std::vector<std::unique_ptr<TableUpdate>>& updates) = 0;
   ```



##########
src/iceberg/table.h:
##########
@@ -109,6 +109,11 @@ class ICEBERG_EXPORT Table {
   /// filter data.
   virtual std::unique_ptr<TableScanBuilder> NewScan() const;
 
+  /// \brief Create a new transaction for this table
+  ///
+  /// \return a shared pointer to the new Transaction
+  virtual std::shared_ptr<Transaction> NewTransaction() const;

Review Comment:
   ```suggestion
     virtual std::unique_ptr<Transaction> NewTransaction() const;
   ```



##########
src/iceberg/catalog.h:
##########
@@ -140,6 +140,21 @@ class ICEBERG_EXPORT Catalog {
       const std::string& location,
       const std::unordered_map<std::string, std::string>& properties) = 0;
 
+  /// \brief Start a transaction to replace a table
+  ///
+  /// \param identifier a table identifier
+  /// \param schema a schema
+  /// \param spec a partition spec
+  /// \param location a location for the table; leave empty if unspecified
+  /// \param properties a string map of table properties
+  /// \param orCreate whether to create the table if not exists
+  /// \return a Transaction to replace the table or ErrorKind::kNotFound if 
the table
+  /// doesn't exist and orCreate is false
+  virtual Result<std::shared_ptr<Transaction>> StageReplaceTable(
+      const TableIdentifier& identifier, const Schema& schema, const 
PartitionSpec& spec,
+      const std::string& location,
+      const std::unordered_map<std::string, std::string>& properties, bool 
orCreate) = 0;
+

Review Comment:
   ```suggestion
   ```



##########
src/iceberg/catalog.h:
##########
@@ -223,6 +247,16 @@ class ICEBERG_EXPORT Catalog {
     ///
     /// \return the Transaction to create the table
     virtual std::unique_ptr<Transaction> StageCreate() = 0;
+
+    /// \brief Starts a transaction to replace the table
+    ///
+    /// \return the Transaction to replace the table
+    virtual std::unique_ptr<Transaction> StageReplace() = 0;
+
+    /// \brief Starts a transaction to create or replace the table
+    ///
+    /// \return the Transaction to create or replace the table
+    virtual std::unique_ptr<Transaction> StageCreateOrReplace() = 0;

Review Comment:
   ```suggestion
   ```



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