Skip to content

Conversation

@steFaiz
Copy link
Contributor

@steFaiz steFaiz commented Dec 23, 2025

Purpose

This PR is a part of #6834, aiming to provide capability in paimon-common module.

File Format

The introduced BTree Index File is also base on SST File Format, with slight difference with LookupStore File, as illustrated below:
image

The file is composed by:

  1. A normal sst file
  2. A null bitmap
  3. A Footer containing all handles and magic number

File Entry

The key-value pair of internal SST File is as below:
image

  • key: the serialized key bytes
  • value: a list of row id, which is encoded as a varLenInt and following varLenLongs.

Tests

Please see:

  • org.apache.paimon.globalindex.btree.BTreeFileMetaSelectorTest
  • org.apache.paimon.globalindex.btree.BTreeGlobalIndexerTest

API and Format

None

Documentation

Will be added in the future.

@steFaiz steFaiz marked this pull request as draft December 23, 2025 12:26
@steFaiz steFaiz force-pushed the btree-index branch 3 times, most recently from d60bf1b to a2134dd Compare December 24, 2025 14:37
@steFaiz steFaiz marked this pull request as ready for review December 25, 2025 03:16
@steFaiz
Copy link
Contributor Author

steFaiz commented Dec 25, 2025

Test failures are irrelevant to this PR. Will try to reopen after all reviews addressed.

@JingsongLi
Copy link
Contributor

@steFaiz Can you open actions in your repo too? This allows for double verification.

@steFaiz
Copy link
Contributor Author

steFaiz commented Dec 25, 2025

@JingsongLi Thanks! I've enabled all workflows in my forked repo.

@JingsongLi
Copy link
Contributor

I think we can just introduce another format.
Lookup Sst file:

 *     +-----------------------------------+------+
 *     |             Footer                |      |
 *     +-----------------------------------+      |
 *     |           Index Block             |      +--> Loaded on open
 *     +-----------------------------------+      |
 *     |        Bloom Filter Block         |   +-->  Loaded on first Lookup, memory can be expired
 *     +-----------------------------------+------+
 *     |            Data Block             |      |
 *     +-----------------------------------+      |
 *     |              ......               |      +--> Loaded on requested
 *     +-----------------------------------+      |
 *     |            Data Block             |      |
 *     +-----------------------------------+------+

BTree Index File:

 *     +-----------------------------------+------+
 *     |             Footer                |      |
 *     +-----------------------------------+      |
 *     |           Index Block             |      +--> Loaded on open
 *     +-----------------------------------+      |
 *     |        Bloom Filter Block       |      +--> Loaded on first Lookup, memory can be expired
 *     +-----------------------------------+      |
 *     |         Null bitmap Block    |      +--> Loaded on requested
 *     +-----------------------------------+------+
 *     |            Data Block             |      |
 *     +-----------------------------------+      |
 *     |              ......               |      +--> Loaded on requested
 *     +-----------------------------------+      |
 *     |            Data Block             |      |
 *     +-----------------------------------+------+

@steFaiz
Copy link
Contributor Author

steFaiz commented Dec 25, 2025

I think we can just introduce another format. Lookup Sst file:

Thanks for your inspiration! I will try to refactor the code!

Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@JingsongLi JingsongLi merged commit 7dd7fa0 into apache:master Dec 26, 2025
21 of 23 checks passed
jerry-024 added a commit to jerry-024/paimon that referenced this pull request Dec 29, 2025
* upstream/master: (51 commits)
  [test] Fix unstable test: handle MiniCluster shutdown gracefully in collect method (apache#6913)
  [python] fix ray dataset not lazy loading issue when parallelism = 1 (apache#6916)
  [core] Refactor ExternalPathProviders abstraction
  [spark] fix Merge Into unstable tests (apache#6912)
  [core] Enable Entropy Inject for data file path to prevent being throttled by object storage (apache#6832)
  [iceberg] support millisecond timestamps in iceberg compatibility mode (apache#6352)
  [spark] Handle NPE for pushdown aggregate when a datasplit has a null max/min value (apache#6611)
  [test] Fix unstable case testLimitPushDown
  [core] Refactor row id pushdown to DataEvolutionFileStoreScan
  [spark] paimon-spark supports row id push down (apache#6697)
  [spark] Support compact_database procedure (apache#6328) (apache#6910)
  [lucene] Fix row count in IndexManifestEntry
  [test] Remove unstable test: AppendTableITCase.testFlinkMemoryPool
  [core] Refactor Global index writer and reader for Btree
  [core] Minor refactor to magic number into footer
  [core] Support btree global index in paimon-common (apache#6869)
  [spark] Optimize compact for data-evolution table, commit multiple times to avoid out of memory (apache#6907)
  [rest] Add fromSnapshot to rollback (apache#6905)
  [test] Fix unstable RowTrackingTestBase test
  [core] Simplify FileStoreCommitImpl to extract some classes (apache#6904)
  ...
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