World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
title: "Manage Table Partitions" slug: "/manage-table-partition-using-gravitino" keyword: "partition management, partition, Gravitino" license: "This software is licensed under the Apache License version 2."
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
Introduction
This page covers the Gravitino API for partitions. For what a partition is, the partition types, and which catalogs support managing them, see Partitions.
Partition management works on Hive and Doris catalogs. Iceberg, MySQL, and PostgreSQL catalogs manage partitions themselves and do not expose them here.
Partition Operations
Add a Partition
The partition type must match the table's partitioning strategy. The three shapes are below.
{
"type": "identity",
"name": "dt=2026-08-02/country=us",
"fieldNames": [["dt"], ["country"]],
"values": [
{"type": "literal", "dataType": "date", "value": "2026-08-02"},
{"type": "literal", "dataType": "string", "value": "us"}
]
}
values must be in the same order as fieldNames. On a Hive table the partition name is ignored,
since Hive derives it from the field names and values.
{
"type": "range",
"name": "p20260802",
"upper": {"type": "literal", "dataType": "date", "value": "2026-08-02"},
"lower": {"type": "literal", "dataType": "date", "value": "2026-08-01"}
}
{
"type": "list",
"name": "p_north_america",
"lists": [
[{"type": "literal", "dataType": "string", "value": "us"}],
[{"type": "literal", "dataType": "string", "value": "ca"}]
]
}
curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" -d '{
"partitions": [
{
"type": "identity",
"name": "dt=2026-08-02/country=us",
"fieldNames": [["dt"], ["country"]],
"values": [
{"type": "literal", "dataType": "date", "value": "2026-08-02"},
{"type": "literal", "dataType": "string", "value": "us"}
]
}
]
}' http://localhost:8090/api/metalakes/example/catalogs/sales/schemas/public/tables/orders/partitions
Table orders = catalog.asTableCatalog().loadTable(
NameIdentifier.of("public", "orders"));
Partition partition = Partitions.identity(
new String[][] {{"dt"}, {"country"}},
new Literal[] {
Literals.dateLiteral(LocalDate.of(2026, 8, 2)),
Literals.stringLiteral("us")
});
orders.supportPartitions().addPartition(partition);
Get a Partition
curl -X GET -H "Accept: application/vnd.gravitino.v1+json" \
"http://localhost:8090/api/metalakes/example/catalogs/sales/schemas/public/tables/orders/partitions/dt=2026-08-02%2Fcountry=us"
Partition partition = orders.supportPartitions().getPartition(
"dt=2026-08-02/country=us");
List Partitions
Listing returns names, or full partition objects when details=true is set.
curl -X GET -H "Accept: application/vnd.gravitino.v1+json" \
http://localhost:8090/api/metalakes/example/catalogs/sales/schemas/public/tables/orders/partitions
curl -X GET -H "Accept: application/vnd.gravitino.v1+json" \
"http://localhost:8090/api/metalakes/example/catalogs/sales/schemas/public/tables/orders/partitions?details=true"
String[] names = orders.supportPartitions().listPartitionNames();
Partition[] partitions = orders.supportPartitions().listPartitions();
Drop a Partition
curl -X DELETE -H "Accept: application/vnd.gravitino.v1+json" \
"http://localhost:8090/api/metalakes/example/catalogs/sales/schemas/public/tables/orders/partitions/dt=2026-08-02%2Fcountry=us"
boolean dropped = orders.supportPartitions().dropPartition(
"dt=2026-08-02/country=us");
boolean purged = orders.supportPartitions().purgePartition(
"dt=2026-08-02/country=us");
Dropping removes the partition metadata. Purging removes its data as well, and is not supported by every catalog.