Skip to content

feat(commit): support dropping delete file stats - #190

Open
liujiayi771 wants to merge 2 commits into
apache:mainfrom
liujiayi771:feat/paimon-cpp-kmanifestdeletefiledrops
Open

feat(commit): support dropping delete file stats#190
liujiayi771 wants to merge 2 commits into
apache:mainfrom
liujiayi771:feat/paimon-cpp-kmanifestdeletefiledrops

Conversation

@liujiayi771

@liujiayi771 liujiayi771 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Purpose

This is a follow-up to #187 and adds full support for manifest.delete-file-drop-stats=true in the C++ commit path.

  • Parse and expose the existing Paimon table option.
  • Drop value_stats and value_stats_cols from final DELETE manifest entries.
  • Apply the optimization after scan filtering and pruning for overwrite and append compaction paths.
  • Preserve complete statistics for ADD entries, generic metadata scans, and writer restore.
  • Keep writer restore statistics until the final entry kind is known, intentionally avoiding the metadata-only level-upgrade bug tracked in [Bug] manifest.delete-file-drop-stats causes empty stats after compaction paimon#7026.

Tests

  • cmake --build build --target paimon_static paimon_shared -j8
  • cmake --build build --target paimon-core-test -j8
  • ./build/debug/paimon-core-test --gtest_brief=1 (1629 tests passed)
  • pre-commit run --files <changed files>
  • git diff --check apache/main...HEAD

API and Format

Adds the public option key kManifestDeleteFileDropStats.

There is no manifest schema or protocol change. When enabled, DELETE entries store empty value statistics and an empty value-statistics column list, matching the existing Paimon format. ADD entries retain complete statistics for file skipping.

Documentation

This implements an existing Paimon table option. No documentation files are included in this PR.

Generative AI tooling

Generated-by: Codex (GPT-5) and Claude Code.

@liujiayi771
liujiayi771 marked this pull request as ready for review August 9, 2026 02:19
@liujiayi771

Copy link
Copy Markdown
Contributor Author

cc @lucasfang @lxy-9602

/// @param default_num_bucket Bucket count used when a commit message omits it.
/// @param drop_delete_file_stats Whether DELETE data-file entries should omit value stats.
explicit ManifestEntryChanges(int32_t default_num_bucket, bool drop_delete_file_stats = false);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could we avoid using a default argument here? In production code, it’s better to pass the parameter explicitly.

// Paimon Java currently drops value stats during writer restore. This is a known bug: a
// restored file can become a compact-after ADD via metadata-only level upgrade and lose its
// stats (https://github.com/apache/paimon/issues/7026). C++ intentionally does not align with
// that behavior; stats are dropped later only when the final entry kind is DELETE.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice catch! Could you please add a PK compaction end-to-end test in pk_compaction_inte_test.cpp to demonstrate that level upgrades do not lose their stats?

Comment thread include/paimon/defs.h

/// "manifest.delete-file-drop-stats" - Whether final DELETE manifest entries should omit
/// value statistics. Default is false.
static const char MANIFEST_DELETE_FILE_DROP_STATS[];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also, could you complete the comment here? I noticed that the Java version also includes: “Default value is false only for compatibility with old readers.”

liujiayi771 and others added 2 commits August 9, 2026 18:34
Honor manifest.delete-file-drop-stats during commit scans and manifest entry creation while preserving statistics for ADD entries and writer restore.

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-5
Co-Authored-By: Claude Code <noreply@anthropic.com>
Require callers to pass drop_delete_file_stats explicitly, document the old-reader compatibility default, and cover PK metadata-only level upgrades end to end.

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-5
@liujiayi771
liujiayi771 force-pushed the feat/paimon-cpp-kmanifestdeletefiledrops branch from e5ec8a0 to b510b91 Compare August 9, 2026 12:54
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.

2 participants