Skip to content

feat(shredding): add shared-shredding map placement policies#384

Open
zjw1111 wants to merge 2 commits into
alibaba:mainfrom
zjw1111:codex/extend-map-column-allocator
Open

feat(shredding): add shared-shredding map placement policies#384
zjw1111 wants to merge 2 commits into
alibaba:mainfrom
zjw1111:codex/extend-map-column-allocator

Conversation

@zjw1111

@zjw1111 zjw1111 commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Purpose

Linked issue: #342

Add shared-shredding map column placement policies for the write path:

  • Replace the previous policy-state abstraction with allocator implementations for plain, sequential, and LRU placement.
  • Add per-column option fields.<column>.map.shared-shredding.column-placement-policy, defaulting to lru.
  • Keep K adaptation state in MapSharedShreddingContext and let MapSharedShreddingBatchConverter read placement policy from CoreOptions when creating per-column allocators.

Tests

  • cmake --build build --target paimon-common-test -j64
  • cmake --build build --target paimon-core-test -j64
  • env LSAN_OPTIONS=detect_leaks=0 build/debug/paimon-common-test --gtest_filter=*MapSharedShredding*
  • env LSAN_OPTIONS=detect_leaks=0 build/debug/paimon-core-test --gtest_filter=CoreOptionsTest.TestDefaultValue:CoreOptionsTest.TestMapStorageLayout:*SharedShredding*
  • git diff --check
  • git diff --cached --check

API and Format

Adds a core option for selecting the shared-shredding map column placement policy. The physical shared-shredding map column assignment can vary by configured policy; the default policy is lru.

Documentation

No.

Generative AI tooling

Generated-by: OpenAI Codex (GPT-5)

Copilot AI review requested due to automatic review settings June 26, 2026 09:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@zjw1111 zjw1111 force-pushed the codex/extend-map-column-allocator branch 4 times, most recently from 3d6ce68 to 534ca95 Compare June 26, 2026 10:53
@zjw1111 zjw1111 force-pushed the codex/extend-map-column-allocator branch from 534ca95 to fc44b2d Compare June 26, 2026 10:55
(last_used_[col] == selected_last_used && col < selected_col))) {
selected_col = col;
selected_last_used = last_used_[col];
}

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.

Please add comments for the strategy.

if (is_empty) {
if (!selected_empty || col < selected_col) {
selected_empty = true;
selected_col = col;

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.

I’m not quite following the purpose of the defensive check col < selected_col here. At the current call site, candidates is constructed in ascending column order, so could we just return as soon as we find a suitable empty one?

])")
.ValueOrDie();

AssertArrayEquals(expected, actual);

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.

Please also check BuildFieldMeta.

PLAIN = 0,
/// Sort field IDs and place fields into columns 0..K-1.
SEQUENTIAL = 1,
/// Choose empty columns first, then the least-recently-used physical column.

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.

I’m not sure this wording is the best fit here. These field IDs are not Paimon field IDs, but an internal shared-shedding concept that is not exposed to users. Could we rewrite the comment to better reflect the user-facing behavior, or add a simple example instead?

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.

3 participants