Nested schemas deeper than 60 levels can be written but not read back by StreamReader or the parquet ArrowReader
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
調査の方向性
Start with StreamReader and StreamDecoder message parsing, then trace get_arrow_schema_from_metadata and parquet_to_arrow_schema_and_fields; the report identifies these as the paths that reject deeply nested schemas. Compare their FlatBuffers verifier options with FileReaderBuilder::with_max_footer_fb_depth. Done means readers can handle the reported depth or expose a configurable limit, with coverage for the depth 60/61 boundary.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
The writers accept a schema with a struct field nested 61 or more levels deep, but the readers reject the result with `DepthLimitReached` (the default flatbuffers verifier depth is 64). `FileReaderBuilder::with_max_footer_fb_depth` lets callers raise the limit for trusted IPC files, but there is no equivalent for:
- `arrow_ipc::reader::StreamReader` / `StreamDecoder`: `parse_message` calls `root_as_message` with the default `VerifierOptions`
- the parquet reader: `get_arrow_schema_from_metadata` calls `root_as_message` on the embedded `ARROW:schema`, and the error fails the whole open (`.transpose()?` in `parquet_to_arrow_schema_and_fields`). The only workaround is `ArrowReaderOptions::with_skip_arrow_metadata(true)`, which drops the Arrow types.
To Reproduce
Struct nested `depth` levels around an Int32 leaf (3 rows), written with default options and read back with default options, on main:
| depth | parquet ArrowWriter -> ArrowReader | IPC StreamWriter -> StreamReader | IPC FileWriter -> FileReader |
|---|---|---|---|
| 60 | Ok | Ok | Ok |
| 61 | `Arrow: Unable to get root as message stored in ARROW:schema: DepthLimitReached` | `Parser error: Unable to get root as message: DepthLimitReached` | `Parser error: Unable to get root as footer: DepthLimitReached` |
With `with_skip_arrow_metadata(true)` the parquet file reads fine at every depth tested (up to 100).
```rust
fn nested_batch(depth: usize) -> RecordBatch {
let mut arr: ArrayRef = Arc::new(Int32Array::from(vec![1, 2, 3]));
let mut field = Field::new("leaf", DataType::Int32, true);
for i in 0..depth {
let f = Arc::new(field);
let s = StructArray::from(vec![(f.clone(), arr)]);
field = Field::new(format!("s{i}"), s.data_type().clone(), true);
arr = Arc::new(s);
}
RecordBatch::try_new(Arc::new(Schema::new(vec![field])), vec![arr]).unwrap()
}
let batch = nested_batch(61);
let mut buf = Vec::new();
let mut w = ArrowWriter::try_new(&mut buf, batch.schema(), None).unwrap();
w.write(&batch).unwrap();
w.close().unwrap();
// Err: Unable to get root as message stored in ARROW:schema: DepthLimitReached
ParquetRecordBatchReaderBuilder::try_new(Bytes::from(buf)).unwrap();
```
Expected behavior
Either a file written with default options can be read with default options, or the reader that rejects it gives a way to raise the limit for trusted input, as `FileReaderBuilder` already does. Some options:
1. Add a max-depth option to `StreamReader`/`StreamDecoder` and to `ArrowReaderOptions` (keeping 64 as the default).
2. Have the writers return an error up front when the schema is too deep for the default reader settings.
Additional context
Tested on main (ede2aeede), Windows, debug build. The 64 default is documented on `FileReaderBuilder::with_max_footer_fb_depth` as "roughly ... a field nested 60 levels down through other struct fields", which matches the boundary above, so the limit itself looks intentional. The gap is that only the IPC file reader can raise it, and nothing stops a writer from producing a file the default readers refuse.
Willingness to contribute
I would like to contribute a fix for this bug, but request guidance from the community
- 主要言語
- Rust
- スター
- 3.7k
- フォーク
- 1.5k
- 平均マージ
- 2日 16時間
- マージ済み PR(30日)
- 183
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/arrow-rs のほかの issue
-
parquet: `ArrowWriter::try_new` panics on a schema with a Union field instead of returning an errorオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
`RunArray::try_new` rejects run ends whose null buffer has no nulls対応中かも @Surajsuthar が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
apache/arrow-rs#12427 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[Variant] `variant_get` string and binary cast errors show Rust builder type names再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 61/100
メンテナーはふだん 1 日以内に返信
apache/arrow-rs の issue をすべて見る
似ている issue
-
TypeScript BM25 drops supplementary characters at the token length limit対応中かも @ErenAta16 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
chroma-core/chroma#8038 ·
メンテナーはふだん 1 日以内に返信
-
p3 ready
難易度 2/5 1〜3時間 初心者へのやさしさ 71/100
メンテナーはふだん 1 日以内に返信
-
area:ui effort:medium enhancement P7 source:agent
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
marketing
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
machine rename accepts a label already used by another machine, making --machine <label> ambiguousオープンmaintainer-needed p2 remote triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信