Package org.apache.iceberg.actions
Interface RewriteTablePath
- All Superinterfaces:
Action<RewriteTablePath,RewriteTablePath.Result>
- All Known Implementing Classes:
RewriteTablePathSparkAction
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:
- Complete copy: Rewrites all metadata files to the staging directory.
- Incremental copy: 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.
The action returns the following:
- 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.
- A 'copy-plan'. This is 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 a functioning version of the source table to the target prefix.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThe action result that contains a summary of the execution. -
Method Summary
Modifier and TypeMethodDescriptiondefault RewriteTablePathcreateFileList(boolean createFileList) Whether to create the file list.endVersion(String endVersion) Last metadata version to rewrite, identified by name of a metadata.json file in the table's metadata log.default RewriteTablePathexecuteWith(ExecutorService executorService) Passes an alternative executor service that will be used for version file and manifest list rewriting.rewriteLocationPrefix(String sourcePrefix, String targetPrefix) Configure a source prefix that will be replaced by the specified target prefix in all pathsstagingLocation(String stagingLocation) Custom staging location.startVersion(String startVersion) First metadata version to rewrite, identified by name of a metadata.json file in the table's metadata log.
-
Method Details
-
rewriteLocationPrefix
Configure a source prefix that will be replaced by the specified target prefix in all paths- Parameters:
sourcePrefix- the source prefix to be replacedtargetPrefix- the target prefix- Returns:
- this for method chaining
-
startVersion
First metadata version to rewrite, identified by name of a metadata.json file in the table's metadata log. It is optional, if provided then this action will only rewrite metadata files added after this version.- Parameters:
startVersion- name of a metadata.json file. For example, "00001-8893aa9e-f92e-4443-80e7-cfa42238a654.metadata.json".- Returns:
- this for method chaining
-
endVersion
Last metadata version to rewrite, identified by name of a metadata.json file in the table's metadata log. It is optional, if provided then this action will only rewrite metadata files added before this file, including the file itself.- Parameters:
endVersion- name of a metadata.json file. For example, "00001-8893aa9e-f92e-4443-80e7-cfa42238a654.metadata.json".- Returns:
- this for method chaining
-
stagingLocation
Custom staging location. It is optional. By default, staging location is a subdirectory under table's metadata directory.- Parameters:
stagingLocation- the staging location- Returns:
- this for method chaining
-
createFileList
Whether to create the file list.The default value is true, which means the file list will be created. If set to false, the file list will not be created.
- Parameters:
createFileList- true to create the file list, false to skip it- Returns:
- this instance for method chaining
-
executeWith
Passes an alternative executor service that will be used for version file and manifest list rewriting. If this method is not called, these operations will be performed sequentially.- Parameters:
executorService- an executor service to parallelize metadata rewriting- Returns:
- this for method chaining
-