dramaticlly commented on code in PR #12115: URL: https://github.com/apache/iceberg/pull/12115#discussion_r1945679456
########## docs/docs/spark-procedures.md: ########## @@ -972,4 +972,101 @@ CALL catalog_name.system.compute_table_stats(table => 'my_table', snapshot_id => Collect statistics of the snapshot with id `snap1` of table `my_table` for columns `col1` and `col2` ```sql CALL catalog_name.system.compute_table_stats(table => 'my_table', snapshot_id => 'snap1', columns => array('col1', 'col2')); -``` \ No newline at end of file +``` + +## Table Replication + +The `rewrite-table-path` procedure prepares an Iceberg table for moving or copying to another. + +### `rewrite-table-path` + +Stages a copy of the Iceberg table's metadata files where every absolute path source prefix is replaced to the specified target. +This can be the starting point to fully or incrementally copy an Iceberg table located under an absolute path under a +source prefix to another under the target prefix. + +!!! info + This procedure only prepares metadata for an existing Iceberg table in preparation for a copy or move to a new location. + Copying/Moving metadata and data files to the new location is not part of this procedure. + + + +| Argument Name | Required? | default | Type | Description | +|--------------------|-----------|------------------------------------------------|--------|-------------------------------------------------------------------------| +| `table` | ✔️ | | string | Name of the table | +| `source_prefix` | ✔️ | | string | The existing prefix to be replaced | +| `target_prefix` | ✔️ | | string | The replacement prefix for `source_prefix` | +| `start_version` | | first metadata.json in table's metadata log | string | The name or path to the chronologically first metadata.json to rewrite. | +| `end_version` | | latest metadata.json | string | The name or path to the chronologically last metadata.json to rewrite | +| `staging_location` | | new directory under table's metadata directory | string | The output location for newly modified metadata files | + + +#### Modes of operation: + +- Full Rewrite: + +By default, the procedure operates in full rewrite mode, rewriting all reachable metadata files. This includes metadata.json, manifest lists, manifests, and position delete files. + +- Incremental Rewrite: + +If `start_version` is provided, the procedure will only rewrite metadata files created between `start_version` and `end_version`. `end_version` defaults to the latest metadata location of the table. Review Comment: I think `end_version` can actually take either path to the file or just file name but name is more consist with examples below -- 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