Native MergeRows can panic or produce wrong masks - arrow 59 `and_not` mishandles sliced arrays
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 76/100
調査の方向性
merge_rows.rs の625~626行付近から始め、MergeRowsStream が一致しない行のマスクをどのように構築するかを追ってください。提供されたスライス済み配列の例で Arrow 59 の動作を再現し、マスクが and(a, not(b)) と一致すること、およびネイティブの MergeRows がパニックしなくなることを確認してください。issue では、回避策として2つの and_not 呼び出しを置き換えることが提案されています。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
MergeRowsStream builds the "not matched" masks with arrow::compute::kernels::boolean::and_not (merge_rows.rs:625-626). In arrow 59.x and_not mixes up the offsets of its inputs when one of them is a slice (apache/arrow-rs#10698, fixed in apache/arrow-rs#10699 for 60.0.0, not backported). Comet main resolves arrow to 59.3.2, so the bug is still there.
After the full outer join one marker column can be a slice with a non-zero offset. Then the task either panics with offset + len out of bounds, or gets wrong masks with no error and applies inserts and deletes to the wrong rows. We hit the panic on Iceberg MERGE with spark.comet.exec.mergeRows.enabled=true (Comet 1.2.0, Spark 4.0.2); with the flag off the jobs pass.
Steps to reproduce
// arrow = "=59.3.2"
use arrow::array::{Array, BooleanArray};
use arrow::compute::kernels::boolean::{and, and_not, not};
fn mask(len: usize, f: fn(usize) -> bool) -> BooleanArray {
BooleanArray::from((0..len).map(f).collect::<Vec<_>>())
}
fn main() {
let left = mask(3000, |i| i % 3 != 0).slice(0, 1000);
let right = mask(2000, |i| i % 5 == 0).slice(1000, 1000);
let expected = and(&left, ¬(&right).unwrap()).unwrap();
let actual = and_not(&left, &right).unwrap();
let wrong = (0..1000).filter(|&i| actual.value(i) != expected.value(i)).count();
println!("wrong values: {wrong} of 1000"); // 59.x: 533, 60.1: 0
}
Expected behavior
and_not(a, b) gives the same result as and(a, not(b)), and native MergeRows does not panic.
Additional context
Until Comet moves to arrow 60 (#7249), replacing the two calls with and(a, ¬(b)?) fixes it.
Willingness to contribute
I can contribute a fix for this bug independently
- 主要言語
- Scala
- スター
- 1.3k
- フォーク
- 418
- 平均マージ
- 2日 23時間
- マージ済み PR(30日)
- 158
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/datafusion-comet のほかの issue
-
`IcebergWriteExec` and `CometIcebergWriteExec` are marked with `!` (missing input) in EXPLAIN対応中かも @Visorgood が今日担当しました。 オープンbug requires-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
apache/datafusion-comet#7622 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
-
requires-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
apache/datafusion-comet#7583 ·
メンテナーはふだん 2 日以内に返信
-
bug priority:medium
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
apache/datafusion-comet#7559 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
-
area:writer bug priority:low
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/datafusion-comet#7558 ·
メンテナーはふだん 2 日以内に返信
-
Comet Native Executors: run a query in Spark when Comet is turned off対応中かも @andygrove が 8 日前に担当しました。 オープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/datafusion-comet#7557 ·
メンテナーはふだん 2 日以内に返信
apache/datafusion-comet の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
lichess-org/lila#22506 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
15-minutes 5-minutes algorithm any-language beginner-friendly c cpp csharp easy go good first issue hacktoberfest help wanted java javascript kotlin python rust swift typescript
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
Huerte/algo-solutions-python#260 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
cpp-best-practices/project_validator#245 ·
メンテナーはふだん 1 日以内に返信
-
python 🐍 Task 🔧
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
valkey-io/valkey-glide#7709 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
zio/zio-logging#1181 ·
メンテナーはふだん 1 日以内に返信