Skip to content

refactor(btree): optimize BTreeFileMetaSelector with zero-copy comparator#280

Merged
lxy-9602 merged 3 commits into
alibaba:mainfrom
lxy-9602:improve-btree-efficiency3
May 14, 2026
Merged

refactor(btree): optimize BTreeFileMetaSelector with zero-copy comparator#280
lxy-9602 merged 3 commits into
alibaba:mainfrom
lxy-9602:improve-btree-efficiency3

Conversation

@lxy-9602
Copy link
Copy Markdown
Collaborator

@lxy-9602 lxy-9602 commented May 13, 2026

Purpose

Linked issue: #38

Optimize BTreeFileMetaSelector key comparison to use zero-copy MemorySlice comparator,
consistent with BTreeGlobalIndexReader.

  • Replace DeserializeKey + Literal::CompareTo with MemorySlice::SliceComparator
  • Use MemorySegment::WrapView for non-copying key slices

Tests

API and Format

Documentation

Generative AI tooling

Generated-by: Claude-4.6-Opus

@zjw1111 zjw1111 requested a review from Copilot May 13, 2026 10:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR refactors BTreeFileMetaSelector to speed up key comparisons by switching from Literal deserialization/comparison to a zero-copy MemorySlice comparator, aligning the comparison approach with BTreeGlobalIndexReader.

Changes:

  • Introduce a cached MemorySlice::SliceComparator in BTreeFileMetaSelector.
  • Replace DeserializeKey + Literal::CompareTo with SerializeLiteral + MemorySlice comparator calls.
  • Add WrapKeySlice to build non-owning key slices from stored key bytes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/paimon/common/global_index/btree/btree_file_meta_selector.h Adds MemorySlice comparator support and new helper APIs (SerializeLiteral, WrapKeySlice).
src/paimon/common/global_index/btree/btree_file_meta_selector.cpp Switches all predicate comparisons to MemorySlice comparator and implements the new slice helpers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/paimon/common/global_index/btree/btree_file_meta_selector.cpp
Comment thread src/paimon/common/global_index/btree/btree_file_meta_selector.cpp
Comment thread src/paimon/common/global_index/btree/btree_file_meta_selector.h
Comment thread src/paimon/common/global_index/btree/btree_file_meta_selector.cpp
@lxy-9602 lxy-9602 merged commit 9329464 into alibaba:main May 14, 2026
13 checks passed
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