Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions docs/docs/spark-procedures.md
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,38 @@ Collect statistics of the snapshot with id `snap1` of table `my_table` for colum
CALL catalog_name.system.compute_table_stats(table => 'my_table', snapshot_id => 'snap1', columns => array('col1', 'col2'));
```

## Partition Statistics

### `compute_partition_stats`

This procedure computes the [partition stats](../../spec.md#partition-statistics) incrementally from the last snapshot that has a `PartitionStatisticsFile`
until the given snapshot (uses current snapshot if not specified) and writes the combined result into a `PartitionStatisticsFile`.
It performs a full compute if the previous partition statistics file does not exist. It also registers the
`PartitionStatisticsFile` to the table metadata.

| Argument Name | Required? | Type | Description |
|---------------|-----------|---------------|--------------------------------------------------------------------------------|
| `table` | ✔️ | string | Name of the table |
| `snapshot_id` | | string | Id of the snapshot to compute partition stats. Defaults to current snapshot id |

#### Output

| Output Name | Type | Description |
|-------------------|--------|----------------------------------------------------------|
| `partition_statistics_file` | string | Path to the partition stats file created from by command |

#### Examples

Collect partition statistics of the latest snapshot of table `my_table`
```sql
CALL catalog_name.system.compute_partition_stats('my_table');
```

Collect partition statistics of the snapshot with id `snap1` of table `my_table`
```sql
CALL catalog_name.system.compute_partition_stats(table => 'my_table', snapshot_id => 'snap1');
```

## Table Replication

The `rewrite_table_path` procedure prepares an Iceberg table for copying to another location.
Expand Down