apache / apache/paimon

[Bug] manifest.delete-file-drop-stats causes empty stats after compaction

Open
#7,026 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
3.4k
Forks
1.4k
Avg merge
1d 11h
Merged PRs (30d)
396

Description

### Search before asking

- [x] I searched in the [issues](https://github.com/apache/paimon/issues) and found nothing similar.

### Paimon version

1.3.1

### Compute Engine

Flink, Java API

### Minimal reproduce step

- Create a PK table with `metadata.stats-mode = "full"` and `metadata.delete-file-drop-stats = "true"`
- Write a few records
- Inspect manifest: manifest entries contain stats
- Run compaction
- Inspect manifest: manifest entries no longer contain stats

Compaction create commits that are DELETE and ADD on the same data file, changing the "level" of the data file only.
With `manifest.delete-file-drop-stats` enabled, this means stats are empty after compaction

### What doesn't meet your expectations?

Intuitively, `metadata.delete-file-drop-stats` should drop stats when data is deleted, and should keep stats on new writes.

Since compaction is very important for PK tables, there should be a way to persist stats through this kind of compaction commits for PK tables.

Alternatively, documentation should be made clearer to explain this is the behaviour for PK tables, and that `metadata.delete-file-drop-stats` should not be enabled if stats are needed

### Anything else?

_No response_

### Are you willing to submit a PR?

- [x] I'm willing to submit a PR!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the issue with a PK table using metadata.stats-mode="full" and metadata.delete-file-drop-stats="true", then trace manifest handling during compaction commits that DELETE and ADD the same data file. Done means compaction no longer causes the manifest entries' stats to become empty, or the behavior is clearly documented if preservation is not supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
data-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.