Skip to content

[core][flink] Preserve file stats during primary-key compaction - #9131

Open
liujiayi771 wants to merge 1 commit into
apache:masterfrom
liujiayi771:fix/paimon-drop-stats-bug
Open

[core][flink] Preserve file stats during primary-key compaction#9131
liujiayi771 wants to merge 1 commit into
apache:masterfrom
liujiayi771:fix/paimon-drop-stats-bug

Conversation

@liujiayi771

@liujiayi771 liujiayi771 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Purpose

Fixes #7026.

When manifest.delete-file-drop-stats is enabled, scan-level dropStats() strips stats from every scanned manifest entry, not just DELETE entries. During primary-key compaction, metadata-only level upgrades can reuse the same data file for DELETE and ADD entries. If compactor or restore scans drop the stats first, the ADD entry permanently loses file value stats and subsequent reads lose data-skipping metadata.

This change keeps stats on scan results and applies copyWithoutStats() only while constructing DELETE manifest entries. ADD entries therefore preserve file stats, while DELETE entries still omit them according to the configured option.

Tests

  • ASDF_MAVEN_VERSION=3.9.9 mvn -pl paimon-core -Pfast-build -DwildcardSuites=none -Dtest=TableWriteTest#testDropStatsOnlyForDeleteManifestEntries test
  • ASDF_MAVEN_VERSION=3.9.9 mvn -pl paimon-flink/paimon-flink-common -Pfast-build -Pflink1 -DwildcardSuites=none -Dtest=TableWriteCoordinatorTest#testScanPreservesStatsWhenDeleteManifestStatsAreDropped,CompactorSourceITCase#testStreamingReadPreservesStatsWhenDeleteManifestStatsAreDropped test
  • git diff --check github/master...HEAD

Preserve file value stats across primary-key writer restore and compactor scans so metadata-only level upgrades do not permanently lose skipping metadata. Drop stats only when constructing DELETE manifest entries.

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-5.6-sol
Co-Authored-By: Claude Code <noreply@anthropic.com>
@liujiayi771
liujiayi771 marked this pull request as ready for review August 9, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant