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

[C++] ListArray::FromListView gives wrong nulls for sliced list-view arrays

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

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

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

调研方向

从 cpp/src/arrow/array/array_nested.cc 中的 ListFromListViewImpl 开始,将其对 validity-bitmap 的访问方式与 FlattenListViewArray 进行比较,尤其关注 offset 的处理。使用切片后的 list-view 示例重现该问题,然后添加或更新回归测试,以确保 ListArray::FromListView 和 LargeListArray::FromListView 保留输入中的 null。

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

描述

Component: C++
Describe the bug, including details regarding any error messages, version, and platform.

ListArray::FromListView (and LargeListArray::FromListView) returns the wrong validity for a sliced list-view array with nulls.

auto views = arrow::json::ArrayFromJSONString(
                 arrow::list_view(arrow::int32()),
                 "[[1], [2], [3], [4], [5], [6], [7], [8], null, [10], [11]]")
                 .ValueOrDie();
auto sliced = std::static_pointer_cast<arrow::ListViewArray>(views->Slice(1));
auto lists =
    arrow::ListArray::FromListView(*sliced, arrow::default_memory_pool()).ValueOrDie();
// is null (list view): 0 0 0 0 0 0 0 1 0 0
// is null (list):      0 0 1 1 1 1 1 1 1 1

Expected: the same nulls as the input.

In ListFromListViewImpl (cpp/src/arrow/array/array_nested.cc), the validity bitmap is read with list_view_data->GetValues<uint8_t>(0), which already advances the pointer by offset bytes. It is then passed to bit_util::GetBit(in_validity_bitmap, list_view_data->offset + i), which applies the offset again, in bits. FlattenListViewArray in the same file does this correctly with GetValues<uint8_t>(0, 0).

Found while trying to use FromListView in a compute kernel (GH-33295). Related: GH-51612, where the list_view to list cast could use FromListView. Reproduced on current main, Linux x86_64.

Component(s)

C++

主要语言
C++
星标
17.1k
派生
4.3k
平均合并
4 天 5 小时
30 天内合并 PR
106

环境准备

从这里开始

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

apache/arrow 的其他 Issue

查看 apache/arrow 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

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