Interface RewriteTablePath

All Superinterfaces:
Action<RewriteTablePath,RewriteTablePath.Result>

public interface RewriteTablePath extends Action<RewriteTablePath,RewriteTablePath.Result>
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.
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.

The action returns the following:

  1. 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.
  2. 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.
  • Method Details

    • rewriteLocationPrefix

      RewriteTablePath rewriteLocationPrefix(String sourcePrefix, String targetPrefix)
      Configure a source prefix that will be replaced by the specified target prefix in all paths
      Parameters:
      sourcePrefix - the source prefix to be replaced
      targetPrefix - the target prefix
      Returns:
      this for method chaining
    • startVersion

      RewriteTablePath startVersion(String 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

      RewriteTablePath endVersion(String 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

      RewriteTablePath stagingLocation(String 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