zhjwpku commented on code in PR #516:
URL: https://github.com/apache/iceberg-cpp/pull/516#discussion_r2706766665


##########
src/iceberg/update/fast_append.h:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+/// \file iceberg/update/fast_append.h
+
+#include <functional>
+#include <memory>
+#include <string>
+#include <unordered_map>
+#include <unordered_set>
+#include <vector>
+
+#include "iceberg/iceberg_export.h"
+#include "iceberg/manifest/manifest_entry.h"
+#include "iceberg/manifest/manifest_list.h"
+#include "iceberg/result.h"
+#include "iceberg/snapshot.h"
+#include "iceberg/type_fwd.h"
+#include "iceberg/update/append_files.h"
+#include "iceberg/update/snapshot_update.h"
+
+namespace iceberg {
+
+/// \brief Append implementation that adds new manifest files for writes.
+///
+/// FastAppend is optimized for appending new data files to a table, it 
creates new
+/// manifest files for the added data without compacting or rewriting existing 
manifests,
+/// making it faster for write-heavy workloads.
+class ICEBERG_EXPORT FastAppend : public SnapshotUpdate, public AppendFiles {
+ public:
+  /// \brief Create a new FastAppend instance.
+  ///
+  /// \param table_name The name of the table
+  /// \param transaction The transaction to use for this update
+  /// \return A Result containing the FastAppend instance or an error
+  static Result<std::unique_ptr<FastAppend>> Make(
+      std::string table_name, std::shared_ptr<Transaction> transaction);
+
+  /// \brief Append a data file to this update.
+  ///
+  /// \param file The data file to append
+  /// \return Reference to this for method chaining
+  FastAppend& AppendFile(std::shared_ptr<DataFile> file) override;
+
+  /// \brief Append a manifest file to this update.
+  ///
+  /// The manifest must only contain added files (no existing or deleted 
files).
+  /// If the manifest doesn't have a snapshot ID assigned and snapshot ID 
inheritance
+  /// is enabled, it will be used directly. Otherwise, it will be copied with 
the
+  /// new snapshot ID.
+  ///
+  /// \param manifest The manifest file to append
+  /// \return Reference to this for method chaining
+  FastAppend& AppendManifest(const ManifestFile& manifest) override;
+
+  /// \brief Set the target branch for this update.
+  ///
+  /// \param branch The branch name
+  /// \return Reference to this for method chaining
+  FastAppend& ToBranch(const std::string& branch);
+
+  /// \brief Set a summary property.
+  ///
+  /// \param property The property name
+  /// \param value The property value
+  /// \return Reference to this for method chaining
+  FastAppend& Set(const std::string& property, const std::string& value);

Review Comment:
   I reviewed the three classes that override the `Set` method and found that 
they all directly populate SnapshotSummary.Builder. So I moved the `Set` method 
and `SnapshotSummaryBuilder` field into SnapshotUpdate.



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