rahulsmahadev opened a new pull request, #19303:
URL: https://github.com/apache/iceberg/pull/19303

   #17399 defined the `RepairTable` action and said a Spark procedure would 
follow. #17622 added the Spark 4.2 action and #19068 backported it to 3.5, 4.0 
and 4.1, but it can only be called from Java. This adds the procedure:
   
   ```sql
   CALL catalog_name.system.repair_table(table => 'db.sample', dry_run => true, 
repair_column_metrics => true);
   ```
   
   - Arguments: `table` (required), plus `dry_run` and `repair_column_metrics`, 
both optional and false by default. The procedure always runs the file metrics 
repair, the only repair the action has today. A later repair kind can add its 
own flag.
   - There is no `use_caching` argument. In this action caching only saves a 
second read of the manifests, because the footer checks are always cached, and 
an argument can't be removed once released. It's easy to add if someone needs 
it.
   - Output is one row with `repaired_manifests_count` and 
`repaired_entries_count`. In a dry run they count what would be repaired.
   - The procedure refreshes the table before checking it. The bad stats 
usually come from another engine, and a table that the session has already 
cached doesn't see that engine's later commits. Without the refresh, a dry run 
could report nothing to repair on a table that needs it. The commit was already 
safe, because it checks the replaced manifests against the latest metadata. The 
Hive catalog runs of the tests cover this, since it's the only test catalog 
with caching on.
   
   Tests: `TestRepairTableProcedure` covers the procedure's own parts: a 
repair, a dry run that doesn't commit, and column metrics that are only 
repaired when enabled. The repair itself is covered by `TestRepairTableAction` 
and `TestRepairMetrics`.
   
   I'll backport this to Spark 3.5, 4.0 and 4.1 once it lands.
   
   This pull request and its description were written by Isaac.
   


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