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


##########
src/iceberg/update/rewrite_manifests.h:
##########
@@ -0,0 +1,149 @@
+/*
+ * 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/rewrite_manifests.h
+
+#include <functional>
+#include <memory>
+#include <span>
+#include <string>
+#include <unordered_map>
+#include <unordered_set>
+#include <vector>
+
+#include "iceberg/iceberg_export.h"
+#include "iceberg/result.h"
+#include "iceberg/type_fwd.h"
+#include "iceberg/update/snapshot_update.h"
+
+namespace iceberg {
+
+/// \brief API for rewriting manifests for a table.
+///
+/// This API accumulates manifest files, produces a new snapshot of the table
+/// described only by the manifest files that were added, and commits that 
snapshot
+/// as the current.
+///
+/// This API can be used to rewrite matching manifests according to a 
clustering
+/// function as well as to replace specific manifests. Manifests that are 
deleted
+/// or added directly are ignored during the rewrite process. The set of active
+/// files in replaced manifests must be the same as in new manifests.
+///
+/// When committing, these changes will be applied to the latest table 
snapshot.
+/// Commit conflicts will be resolved by applying the changes to the new latest
+/// snapshot and reattempting the commit.
+class ICEBERG_EXPORT RewriteManifests : public SnapshotUpdate {
+ public:
+  using ClusterByFunc = std::function<std::string(const DataFile&)>;

Review Comment:
   I think a hash could merge distinct keys on collisions(though little 
chance). Java accepts an Object key, so I used string here.



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