[Feature] Unpack predicate boolean kernel bitmaps a byte at a time
まだ誰も着手していません。
評価
調査の方向性
src/paimon/common/utils/arrow/ から始めて、MultiLiteralsLeafFunction と NullFalseLeafBinaryFunction を見つけ、既存の bitmap-to-byte ループを LeafFunction::Test まで追跡します。共有 helper と、すべての offset と length、両方の negate 値、バイト境界に揃っていない validity 期間を網羅する property test を追加します。helper が行ごとの accessor reference と一致し、両方の caller が変更されていない bytes を返せば完了です。
索引モデルが issue の本文から書いたものです。
説明
Search before asking
- I searched in the issues and found nothing similar.
Motivation
Two predicate leaf functions evaluate a batch by running an arrow::compute kernel and reading back the arrow::BooleanArray it writes: MultiLiteralsLeafFunction (IN / NOT IN, via IsIn) and NullFalseLeafBinaryFunction (the comparison functions). A kernel returns a bitmap, one bit per row, but LeafFunction::Test returns std::vector<char>, one byte per row, so both call sites spread the bits over bytes with the same per-row loop: test IsNull, read Value, apply the negation NOT IN needs, store a byte. That is a shift, a mask and a byte store per row, duplicated across the two call sites, on the selection path every filtered batch goes through.
Solution
Extract the spread into one helper, ArrowUtils::UnpackBooleansToBytes(array, negate), and read the bitmap a byte at a time instead of a bit at a time:
- A compile-time table maps each of the 256 bitmap bytes to the eight bytes it expands to, so the aligned body produces eight rows per iteration with one lookup and one 8-byte store.
- A scalar head and tail cover the rows sharing a partial leading or trailing byte, which is where the array offset is not byte-aligned; a batch a kernel has just written is aligned, so it takes the fast body throughout.
- The offset and the validity bitmap are honoured exactly as
BooleanArray::Value()andArray::IsValid()honour them, and a null row unpacks to 0 whatever the value bitmap holds for it, which is what bothIN/NOT INand everyNullFalseLeafBinaryFunctionrequire.
MultiLiteralsLeafFunction passes its negate through; NullFalseLeafBinaryFunction passes negate=false. The bytes each returns are unchanged.
Anything else?
A property test that asserts the helper equals a row-by-row reference through the very accessors it replaces, over every (offset, length) slice of a bitmap whose value and null periods are not multiples of eight and both negate values, pins the offset, validity and negate handling against the definitions it optimizes. No change to any header under include/paimon/, the storage format, or the protocol: ArrowUtils is an internal utility under src/paimon/common/utils/arrow/.
Are you willing to submit a PR?
- I'm willing to submit a PR!
- 主要言語
- C++
- スター
- 65
- フォーク
- 29
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 78
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/paimon-cpp のほかの issue
-
enhancement
apache/paimon-cpp#381 · 担当者 1 名 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
apache/paimon-cpp#375 · 担当者 1 名 ·
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
apache/paimon-cpp#361 · 担当者 1 名 ·
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
apache/paimon-cpp#325 · 担当者 1 名 ·
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
apache/paimon-cpp#319 · リアクション 1 件 · 担当者 1 名 ·
apache/paimon-cpp の issue をすべて見る
似ている issue
-
AuTest Bug Tests
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/trafficserver#13714 ·
-
bug build
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
facebookincubator/velox#19143 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
tenstorrent/tt-metal#57393 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
objectionary/eo-graphs#74 ·