`RunArray::try_new` rejects run ends whose null buffer has no nulls
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
arrow-array/src/array/run_array.rs の RunArray::try_new 内にある null チェック(176-182 行目)から始め、null バッファが存在するかどうかではなく run_ends.null_count() != 0 をテストするように変更してください。issue のスニペットで再現し、次に NullBuffer::new_valid を持つ run_ends 配列のテストを追加してください。arrow-data/src/data.rs の ArrayData チェックを読んで、それが依然として成り立つことを確認してください。再現コードが Ok(3) を返し、cargo test -p arrow-array run_array が通れば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
RunArray::try_new returns "Found null values in run_ends array" when run_ends has a null buffer with a null count of 0. It checks whether a null buffer is present, not whether any value is null. A PrimitiveArray can carry such a buffer: PrimitiveArray::new with NullBuffer::new_valid, slice of an array whose nulls fall outside the slice, and concat of a single array all produce one.
ArrayData validation has the same check, and it holds there, because ArrayDataBuilder::build drops a null buffer with no nulls.
To Reproduce
use arrow_array::types::Int32Type;
use arrow_array::{Array, Int32Array, RunArray};
use arrow_buffer::NullBuffer;
fn main() {
let run_ends = Int32Array::new(vec![2, 3].into(), Some(NullBuffer::new_valid(2)));
let values = Int32Array::from(vec![7, 8]);
println!("{}", run_ends.null_count());
// 0
println!("{:?}", RunArray::<Int32Type>::try_new(&run_ends, &values).map(|a| a.len()));
// Err(InvalidArgumentError("Found null values in run_ends array. The run_ends array should not have null values."))
}
Expected behavior
Ok(3). Checking run_ends.null_count() != 0 instead of run_ends.nulls().is_some() would accept it and still reject run ends that hold a null.
Additional context
#12420 makes cast to the same type, shift by 0, and nullif of an empty array return the input's null buffer instead of dropping one with no nulls, so their output reaches this check more often.
Found while checking #12420 with property-based tests, on main at 6a3f719f.
- 主要言語
- Rust
- スター
- 3.7k
- フォーク
- 1.5k
- 平均マージ
- 2日 11時間
- マージ済み PR(30日)
- 195
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/arrow-rs のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信
-
[Variant] `variant_get` string and binary cast errors show Rust builder type names再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 61/100
メンテナーはふだん 1 日以内に返信
-
parquet: GZip/Brotli page decompression is not bounded by the page's uncompressed size対応中かも @Subodh-17 が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
development-process
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
apache/arrow-rs#12145 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
parquet: panic "Decoder for dict should have been set" reading a primitive column whose dictionary page is missing対応中かも @cryptus-neoxys が 12 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
apache/arrow-rs#12129 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
apache/arrow-rs の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
symposium-dev/symposium#530 ·
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
topgrade-rs/topgrade#2540 ·
メンテナーはふだん 1 日以内に返信
-
Invalid JSON options for ngram and edge_ngram silently use defaults対応中かも @Tilendlesa が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
noemaforge/vimanam#153 ·
メンテナーはふだん 1 日以内に返信