Skip to content
22 changes: 22 additions & 0 deletions core/src/main/java/org/apache/iceberg/PartitionsTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ public class PartitionsTable extends BaseMetadataTable {
"position_delete_file_count",
Types.IntegerType.get(),
"Count of position delete files"),
Types.NestedField.required(
12,
"total_position_delete_file_size_in_bytes",
Types.LongType.get(),
"Total size in bytes of position delete files"),
Types.NestedField.required(
7,
"equality_delete_record_count",
Expand All @@ -81,6 +86,11 @@ public class PartitionsTable extends BaseMetadataTable {
"equality_delete_file_count",
Types.IntegerType.get(),
"Count of equality delete files"),
Types.NestedField.required(
13,
"total_equality_delete_file_size_in_bytes",
Types.LongType.get(),
"Total size in bytes of equality delete files"),
Types.NestedField.optional(
9,
"last_updated_at",
Expand Down Expand Up @@ -108,8 +118,10 @@ public Schema schema() {
"total_data_file_size_in_bytes",
"position_delete_record_count",
"position_delete_file_count",
"total_position_delete_file_size_in_bytes",
"equality_delete_record_count",
"equality_delete_file_count",
"total_equality_delete_file_size_in_bytes",
"last_updated_at",
"last_updated_snapshot_id");
}
Expand Down Expand Up @@ -137,8 +149,10 @@ private DataTask task(StaticTableScan scan) {
root.dataFileSizeInBytes,
root.posDeleteRecordCount,
root.posDeleteFileCount,
root.posDeleteFileSizeInBytes,
root.eqDeleteRecordCount,
root.eqDeleteFileCount,
root.eqDeleteFileSizeInBytes,
root.lastUpdatedAt,
root.lastUpdatedSnapshotId));
} else {
Expand All @@ -160,8 +174,10 @@ private static StaticDataTask.Row convertPartition(Partition partition) {
partition.dataFileSizeInBytes,
partition.posDeleteRecordCount,
partition.posDeleteFileCount,
partition.posDeleteFileSizeInBytes,
partition.eqDeleteRecordCount,
partition.eqDeleteFileCount,
partition.eqDeleteFileSizeInBytes,
partition.lastUpdatedAt,
partition.lastUpdatedSnapshotId);
}
Expand Down Expand Up @@ -277,8 +293,10 @@ static class Partition {
private long dataFileSizeInBytes;
private long posDeleteRecordCount;
private int posDeleteFileCount;
private long posDeleteFileSizeInBytes;
private long eqDeleteRecordCount;
private int eqDeleteFileCount;
private long eqDeleteFileSizeInBytes;
private Long lastUpdatedAt;
private Long lastUpdatedSnapshotId;

Expand All @@ -290,8 +308,10 @@ static class Partition {
this.dataFileSizeInBytes = 0L;
this.posDeleteRecordCount = 0L;
this.posDeleteFileCount = 0;
this.posDeleteFileSizeInBytes = 0L;
this.eqDeleteRecordCount = 0L;
this.eqDeleteFileCount = 0;
this.eqDeleteFileSizeInBytes = 0L;
}

void update(ContentFile<?> file, Snapshot snapshot) {
Expand All @@ -314,10 +334,12 @@ void update(ContentFile<?> file, Snapshot snapshot) {
case POSITION_DELETES:
this.posDeleteRecordCount += file.recordCount();
this.posDeleteFileCount += 1;
this.posDeleteFileSizeInBytes += file.fileSizeInBytes();
break;
case EQUALITY_DELETES:
this.eqDeleteRecordCount += file.recordCount();
this.eqDeleteFileCount += 1;
this.eqDeleteFileSizeInBytes += file.fileSizeInBytes();
break;
default:
throw new UnsupportedOperationException(
Expand Down
12 changes: 6 additions & 6 deletions docs/docs/flink-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -492,12 +492,12 @@ To show a table's current partitions:
SELECT * FROM prod.db.table$partitions;
```

| partition | spec_id | record_count | file_count | total_data_file_size_in_bytes | position_delete_record_count | position_delete_file_count | equality_delete_record_count | equality_delete_file_count | last_updated_at(μs) | last_updated_snapshot_id |
| -------------- |---------|---------------|------------|--------------------------|------------------------------|----------------------------|------------------------------|----------------------------|---------------------|--------------------------|
| {20211001, 11} | 0 | 1 | 1 | 100 | 2 | 1 | 0 | 0 | 1633086034192000 | 9205185327307503337 |
| {20211002, 11} | 0 | 4 | 3 | 500 | 1 | 1 | 0 | 0 | 1633172537358000 | 867027598972211003 |
| {20211001, 10} | 0 | 7 | 4 | 700 | 0 | 0 | 0 | 0 | 1633082598716000 | 3280122546965981531 |
| {20211002, 10} | 0 | 3 | 2 | 400 | 0 | 0 | 1 | 1 | 1633169159489000 | 6941468797545315876 |
| partition | spec_id | record_count | file_count | total_data_file_size_in_bytes | position_delete_record_count | position_delete_file_count | total_position_delete_file_size_in_bytes | equality_delete_record_count | equality_delete_file_count | total_equality_delete_file_size_in_bytes | last_updated_at(μs) | last_updated_snapshot_id |
Copy link
Copy Markdown
Member

@ebyhr ebyhr Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Flink expose PartitionsTable as-is? I'm asking this question because this PR doesn't contain any changes in Flink module.

Can we update Flink tests if this PR affects the module?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ebyhr The update is ready. Please take a look.

| -------------- |---------|---------------|------------|--------------------------|------------------------------|----------------------------|------------------------------------------|------------------------------|----------------------------|------------------------------------------|---------------------|--------------------------|
| {20211001, 11} | 0 | 1 | 1 | 100 | 2 | 1 | 50 | 0 | 0 | 0 | 1633086034192000 | 9205185327307503337 |
| {20211002, 11} | 0 | 4 | 3 | 500 | 1 | 1 | 100 | 0 | 0 | 0 | 1633172537358000 | 867027598972211003 |
| {20211001, 10} | 0 | 7 | 4 | 700 | 0 | 0 | 0 | 0 | 0 | 0 | 1633082598716000 | 3280122546965981531 |
| {20211002, 10} | 0 | 3 | 2 | 400 | 0 | 0 | 0 | 1 | 1 | 400 | 1633169159489000 | 6941468797545315876 |

Note:
For unpartitioned tables, the partitions table will not contain the partition and spec_id fields.
Expand Down
12 changes: 6 additions & 6 deletions docs/docs/spark-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,12 +427,12 @@ To show a table's current partitions:
SELECT * FROM prod.db.table.partitions;
```

| partition | spec_id | record_count | file_count | total_data_file_size_in_bytes | position_delete_record_count | position_delete_file_count | equality_delete_record_count | equality_delete_file_count | last_updated_at(μs) | last_updated_snapshot_id |
| -------------- |---------|---------------|------------|--------------------------|------------------------------|----------------------------|------------------------------|----------------------------|---------------------|--------------------------|
| {20211001, 11} | 0 | 1 | 1 | 100 | 2 | 1 | 0 | 0 | 1633086034192000 | 9205185327307503337 |
| {20211002, 11} | 0 | 4 | 3 | 500 | 1 | 1 | 0 | 0 | 1633172537358000 | 867027598972211003 |
| {20211001, 10} | 0 | 7 | 4 | 700 | 0 | 0 | 0 | 0 | 1633082598716000 | 3280122546965981531 |
| {20211002, 10} | 0 | 3 | 2 | 400 | 0 | 0 | 1 | 1 | 1633169159489000 | 6941468797545315876 |
| partition | spec_id | record_count | file_count | total_data_file_size_in_bytes | position_delete_record_count | position_delete_file_count | total_position_delete_file_size_in_bytes | equality_delete_record_count | equality_delete_file_count | total_equality_delete_file_size_in_bytes | last_updated_at(μs) | last_updated_snapshot_id |
| -------------- |---------|---------------|------------|--------------------------|------------------------------|----------------------------|------------------------------------------|------------------------------|----------------------------|------------------------------------------|---------------------|--------------------------|
| {20211001, 11} | 0 | 1 | 1 | 100 | 2 | 1 | 50 | 0 | 0 | 0 | 1633086034192000 | 9205185327307503337 |
| {20211002, 11} | 0 | 4 | 3 | 500 | 1 | 1 | 100 | 0 | 0 | 0 | 1633172537358000 | 867027598972211003 |
| {20211001, 10} | 0 | 7 | 4 | 700 | 0 | 0 | 0 | 0 | 0 | 0 | 1633082598716000 | 3280122546965981531 |
| {20211002, 10} | 0 | 3 | 2 | 400 | 0 | 0 | 0 | 1 | 1 | 400 | 1633169159489000 | 6941468797545315876 |

Note:

Expand Down
Loading
Loading