[C++] GetSchema labels its null check on each schema field as "DictionaryEncoding.indexType"
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
打开 cpp/src/arrow/ipc/metadata_internal.cc,定位到 GetSchema 循环附近(链接的行约 ~1450–1457)。每个字段上的 CHECK_FLATBUFFERS_NOT_NULL 使用了标签 DictionaryEncoding.indexType;要么去掉该检查(如附近注释所建议),要么将其重新标记为类似 Schema.fields[i] 的内容。真正的 DictionaryEncoding.indexType 检查仍在 ~901。当该循环不再报告错误的字段名时即完成。
由索引模型根据 Issue 内容生成。
描述
[!NOTE]
I discovered this issue and wrote it up with help from Claude Opus 5.5.
Describe the enhancement requested
In GetSchema in cpp/src/arrow/ipc/metadata_internal.cc, the loop over a schema's fields checks each field for null with the wrong label:
for (int i = 0; i < num_fields; ++i) {
const flatbuf::Field* field = schema->fields()->Get(i);
// XXX I don't think this check is necessary (AP)
CHECK_FLATBUFFERS_NOT_NULL(field, "DictionaryEncoding.indexType");
RETURN_NOT_OK(
FieldFromFlatbuffer(field, field_pos.child(i), dictionary_memo, &fields[i]));
}
The value being checked is a Field, not DictionaryEncoding.indexType. If the check ever failed, it would report Unexpected null field DictionaryEncoding.indexType in flatbuffer-encoded metadata. That message already belongs to the real check on dictionary index types at line 901, so the two errors would be indistinguishable.
As the comment beside it suggests, the check also appears unable to fail. For a vector of tables, the vendored flatbuffers IndirectHelper<Offset<T>>::Read returns the element's address plus its stored offset, so fields()->Get(i) doesn't return null. The function already checks schema->fields() itself for null, with the correct label Schema.fields.
Either option would fix it:
- Remove the check, as the comment suggests.
- Keep it with an accurate label, such as
"Schema.fields[i]".
I found this while looking into how the reader handles a missing DictionaryEncoding.indexType, which is reported separately at #51779.
- 主要语言
- C++
- 星标
- 17.2k
- 派生
- 4.3k
- 平均合并
- 4 天 5 小时
- 30 天内合并 PR
- 101
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/arrow 的其他 Issue
-
[Ruby] Wrong data pointer in MemoryView of a sliced array可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭Component: Ruby Type: bug
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
[C++][Python] IPC reader rejects a DictionaryEncoding without indexType, which the format allows可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭Component: C++ Component: Python
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
[R] Silent loss of metadata integrity for date-time and numeric attributes in write_parquet()/read_parquet()可能已有人在做 @james-finn-travers 于 5 天前认领。 未关闭Component: R Type: bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
[C++][Parquet] Plaintext-footer files written with AES_GCM_CTR_V1 record AES_GCM_V1 as the encryption algorithm and cannot be read可能已有人在做 @YusefSyed 于 5 天前认领。 未关闭Type: bug
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
[R] Expose ignore_extra_columns and pad_short_rows CSV parse options可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭Component: R good-first-issue Type: enhancement
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
相似的 Issue
-
needs-triage
难度 2/5 1-3 小时 新手友好度 70/100
flashinfer-ai/flashinfer#6212 ·
维护者通常 1 天内回复
-
bug graphics
难度 2/5 1-3 小时 新手友好度 76/100
FlaxEngine/FlaxEngine#4295 · 2 条评论 ·
维护者通常 2 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 66/100
Algorithmiq/monoprop#390 ·
维护者通常 1 天内回复
-
docs
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
leethomason/tinyxml2#1097 ·