Performing manual Iceberg table maintenance using Cloudera Lakehouse Optimizer REST APIs

You can use REST APIs to perform manual table maintenance as needed depending on your assigned role.

  1. Get the current statistics for the required table using the GET /tables/{tableId}/stats API.
    Perform this step to view the current table statistics to compare them with the expected statistics after the maintenance actions are complete.
  2. Dry run the policy to determine whether the generated maintenance actions are as expected using the PUT /policies/{policyName}/tables/{tableName}/dryrun API. The API evaluates the statistics and then generates only a set of maintenance actions.
  3. Initiate the evaluation phase using the POST /policies/{policyName}/tables/{tableName}/evaluation API.
    The 200 response shows a unique task ID that you can use to monitor the task and the task metadata.
  4. Monitor the status of the task using the GET /tasks or GET /tasks/id/{id} API.
  5. Verify whether the task completed the maintenance actions as expected using the GET /tables/{tableId}/stats API.
  6. For a Puffin statistics policy, verify that the table metadata includes a new entry in statisticsFiles pointing to the generated Puffin file.
You can use this workflow to run a Puffin statistics policy manually. For more information, see Puffin statistics for Cloudera Lakehouse Optimizer.