Submit a Lance table data file compaction task. An empty Body or {} is allowed and uses the default parameters.
Permission notes
|
API |
Action |
Description |
|
SubmitLanceTableCompactTask |
oss:PutTableMaintenanceConfiguration |
Submit a table compact task. |
Request syntax
POST /lance/oss/v1/table/{id}/compact HTTP/1.1
Host: {tableBucketHost}
Date: GMT Date
Authorization: SignatureValue
Content-Type: application/json
{
"target_rows_per_fragment": 1048576,
"materialize_deletions": true,
"materialize_deletions_threshold": 0.1,
"max_rows_per_group": 1024,
"max_bytes_per_file": 0,
"compaction_mode": "reencode"
}
Request parameters
The common conventions of this interface (access address, table identifier, request and response headers, permissions, async submission and quota, task status, error codes) are described in Lance table maintenance.
|
Parameter |
Location |
Data type |
Required |
Description |
|
target_rows_per_fragment |
body |
int64 |
No |
Target number of rows per fragment after compaction. Default 1048576, must be greater than 0. |
|
materialize_deletions |
body |
boolean |
No |
Whether to materialize deletion markers into data files. Default true. |
|
materialize_deletions_threshold |
body |
double |
No |
When the ratio of deleted rows in a fragment exceeds this value, compaction rewrites the fragment to materialize deletion markers. Takes effect only when |
|
max_rows_per_group |
body |
int64 |
No |
Maximum number of rows per row group. Default 1024, must be greater than 0. |
|
max_bytes_per_file |
body |
int64 |
No |
Maximum number of bytes per file after compaction (soft limit). Default 0, which means unspecified and uses the system default of 90 GiB; a positive integer applies the specified limit. |
|
compaction_mode |
body |
string |
No |
Compaction mode. The default is the current server-side default, initially reencode. Allowed values: reencode, try_binary_copy, force_binary_copy; case-sensitive. |
compaction_mode notes
When compaction_mode is not specified, each request reads the current server-side default; when a valid value is explicitly provided, the request takes precedence. An empty string is not a valid mode. The effective value is written to params and can be queried via GetLanceTaskStatus. If the server-side default mode configuration is invalid, 500 / InternalError / 18 is returned.
Response
HTTP/1.1 200 OK
Content-Type: application/json
x-oss-table-id: {table_id}
{
"task_id": "123xxxxxxxxxxxxx",
"status": "submitted"
}
task_id is the new task ID, and status is the initial state. Query it with task_type=lance_compact.
Error codes
This interface uses the Lance unified JSON error format. For common error codes and the error response structure, see Lance table maintenance in common conventions.