zhjwpku commented on code in PR #418:
URL: https://github.com/apache/iceberg-cpp/pull/418#discussion_r2629395047
##########
src/iceberg/transaction.h:
##########
@@ -29,28 +30,61 @@
namespace iceberg {
/// \brief A transaction for performing multiple updates to a table
-class ICEBERG_EXPORT Transaction {
+class ICEBERG_EXPORT Transaction : public
std::enable_shared_from_this<Transaction> {
public:
- virtual ~Transaction() = default;
+ enum class Kind : uint8_t { kCreate, kUpdate };
+
+ ~Transaction();
+
+ /// \brief Create a new transaction
+ static Result<std::shared_ptr<Transaction>> Make(std::shared_ptr<Table>
table,
+ Kind kind, bool
auto_commit);
/// \brief Return the Table that this transaction will update
- ///
- /// \return this transaction's table
- virtual const std::shared_ptr<Table>& table() const = 0;
+ const std::shared_ptr<Table>& table() const { return table_; }
- /// \brief Create a new append API to add files to this table
- ///
- /// \return a new AppendFiles
- virtual std::shared_ptr<AppendFiles> NewAppend() = 0;
+ /// \brief Return the base metadata without any changes
Review Comment:
nit: %s/Return/Returns/g
##########
src/iceberg/table.cc:
##########
@@ -110,18 +130,78 @@ const std::vector<SnapshotLogEntry>& Table::history()
const {
return metadata_->snapshot_log;
}
-std::unique_ptr<UpdateProperties> Table::UpdateProperties() const {
- return std::make_unique<iceberg::UpdateProperties>(identifier_, catalog_,
metadata_);
+const std::shared_ptr<FileIO>& Table::io() const { return io_; }
+
+const std::shared_ptr<TableMetadata>& Table::metadata() const { return
metadata_; }
+
+const std::shared_ptr<Catalog>& Table::catalog() const { return catalog_; }
+
+Result<std::unique_ptr<TableScanBuilder>> Table::NewScan() const {
Review Comment:
Why use Result to wrap this? It seems won't return any error.
##########
src/iceberg/update/update_properties.h:
##########
@@ -20,28 +20,24 @@
#pragma once
#include <memory>
+#include <optional>
Review Comment:
```suggestion
```
not used?
--
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]