Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[C++] GetSchema labels its null check on each schema field as "DictionaryEncoding.indexType"

未关闭 适合新手
#51,780 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
88/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
cpp
领域
data

调研方向

打开 cpp/src/arrow/ipc/metadata_internal.cc,定位到 GetSchema 循环附近(链接的行约 ~1450–1457)。每个字段上的 CHECK_FLATBUFFERS_NOT_NULL 使用了标签 DictionaryEncoding.indexType;要么去掉该检查(如附近注释所建议),要么将其重新标记为类似 Schema.fields[i] 的内容。真正的 DictionaryEncoding.indexType 检查仍在 ~901。当该循环不再报告错误的字段名时即完成。

由索引模型根据 Issue 内容生成。

描述

Component: C++

[!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

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/arrow 的其他 Issue

查看 apache/arrow 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。