szehon-ho commented on code in PR #10920:
URL: https://github.com/apache/iceberg/pull/10920#discussion_r1803788034


##########
api/src/main/java/org/apache/iceberg/actions/RewriteTablePath.java:
##########
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+package org.apache.iceberg.actions;
+
+/**
+ * An action that rewrites the table's metadata files to a staging directory, 
replacing all source
+ * prefixes in absolute paths with a specified target prefix. There are two 
modes:
+ *
+ * <ul>
+ *   <li><b>Complete copy:</b> Rewrites all metadata files to the staging 
directory.
+ *   <li><b>Incremental copy:</b> Rewrites a subset of metadata files to the 
staging directory,
+ *       consisting of metadata files added since a specified start version 
and/or until end
+ *       version. The start/end version is identified by the name of a 
metadata.json file, and all
+ *       metadata files added before/after these file are marked for rewrite.
+ * </ul>
+ *
+ * This action can be used as the starting point to fully or incrementally 
copy an Iceberg table
+ * located under the source prefix to the target prefix.
+ *
+ * <p>The action returns the following:
+ *
+ * <ol>
+ *   <li>The name of the latest metadata.json rewritten to staging location. 
After the files are
+ *       copied, this will be the root of the copied table.
+ *   <li>A list of all files added to the table between startVersion and 
endVersion, including their
+ *       original and target paths under the target prefix. This list covers 
both original and
+ *       rewritten files, allowing for copying to the target paths to form the 
copied table.
+ * </ol>
+ */
+public interface RewriteTablePath extends Action<RewriteTablePath, 
RewriteTablePath.Result> {
+
+  /**
+   * Configure a source prefix that will be replaced by the specified target 
prefix in all paths
+   *
+   * @param sourcePrefix the source prefix to be replaced
+   * @param targetPrefix the target prefix
+   * @return this for method chaining
+   */
+  RewriteTablePath rewriteLocationPrefix(String sourcePrefix, String 
targetPrefix);

Review Comment:
   One more thing came up while discussing internally.  This was brought up by 
@huaxiangsun today.  Its possible that the data and metadata are in different 
locations.  In this case, we would need an optional API 
   
   ```
   rewriteLocationPrefix(String sourceDataPrefix, String sourceMetadataPrefix, 
String targetDataPrefix, String targetMetadataPrefix)
   ```
   
   What do you think @laithalzyoud @flyrain let me know if we missed something 
though.
   



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