Skip to content

GH-35692: [C++][Parquet] Support to read fixed size list array with nulls - #50271

Merged
wgtmac merged 5 commits into
apache:mainfrom
HuaHuaY:nested_fixed_size_list_reader
Jul 28, 2026
Merged

GH-35692: [C++][Parquet] Support to read fixed size list array with nulls#50271
wgtmac merged 5 commits into
apache:mainfrom
HuaHuaY:nested_fixed_size_list_reader

Conversation

@HuaHuaY

@HuaHuaYHuaHuaY commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

Support to read fixed size list array with nulls.

What changes are included in this PR?

Modified FixedSizeListReader to add null slots to FixedSizeList.

Are these changes tested?

Yes.

Are there any user-facing changes?

User can read fixed size list array with nulls now.

This PR also fixesGH-35697.

Comment threadcpp/src/parquet/arrow/reader.cc Outdated
int32_t expected_size) -> Status {
std::span<const int32_t> run_offsets(offsets + start,
static_cast<size_t>(length + 1));
const auto first_invalid_offset = std::ranges::adjacent_find(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure C++20 ranges are available on all our CI platforms unfortunately (some of them require old compilers).

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there are no compilation errors in the CI pipelines which are already run.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me enable the more annoying ones :)

@HuaHuaYHuaHuaYJul 9, 2026

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new CI tests have also been compiled, so I haven't changed the code yet.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thisisnic Do you remember how to launch the R builds with the most outdated compilers? :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not off the top of my head, but there should be a recent-ish PR which fixed the last ones that broke it, and will have the CI job being run on it in the comments.

Comment threadcpp/src/parquet/arrow/reader.cc Outdated
Comment threadcpp/src/parquet/arrow/reader.cc Outdated
@pitrou

Copy link
Copy Markdown
Member

@rok FYI :)

@github-actionsgithub-actionsBot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jul 8, 2026
@pitroupitrou added the CI: Extra: R Run extra R CI label Jul 8, 2026
@HuaHuaY
HuaHuaYforce-pushed the nested_fixed_size_list_reader branch from 915c757 to 2fc0d49CompareJuly 9, 2026 09:42
@github-actionsgithub-actionsBot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Jul 13, 2026
Comment threadcpp/src/parquet/arrow/reader.cc Outdated
return Status::OK();
}
child_arrays.push_back(
::arrow::MakeArray(data->child_data[0]->Slice(offsets[start], child_length)));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we avoid creating one Array per validity run? This could become expensive for wide fixed-size lists. Is it possible to use a single builder using AppendArraySlice() and AppendNulls() instead?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a good idea. First, the array is created via Slice, and the actual data isn't copied. Second, Concatenate handles different array types automatically, whereas doing it manually would be too much of a hassle.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern is the per-run object/allocation overhead rather than copying each valid slice: an alternating validity bitmap still creates O(number of runs) Array/ArrayData objects and O(number of null runs) null arrays before the final concatenation.

But I agree that my suggestion requires a lot of changes to handle different child types. I'm fine to keep it as-is by adding a TODO comment for a future improvement?

@HuaHuaYHuaHuaYJul 22, 2026

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a TODO comment in the latest commit.

@wgtmac

Copy link
Copy Markdown
Member

Codex reminded me that code below is outdated after this fix and it seems that level_info.null_slot_usage is useless anymore.

if (output->null_count > 0 && level_info.null_slot_usage > 1) {
throwParquetException(
"Null values with null_slot_usage > 1 not supported."
"(i.e. FixedSizeLists with null values are not supported)");
}

@HuaHuaY
HuaHuaYforce-pushed the nested_fixed_size_list_reader branch from 2fc0d49 to c5cadcfCompareJuly 21, 2026 11:00
@github-actionsgithub-actionsBot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Jul 21, 2026
@HuaHuaY

Copy link
Copy Markdown
ContributorAuthor

Codex reminded me that code below is outdated after this fix and it seems that level_info.null_slot_usage is useless anymore.

This requires modifying the public methods in cpp/src/parquet/level_conversion.h, and I prefer opening a new pull request to address it.

@pitrou

Copy link
Copy Markdown
Member

@HuaHuaY Are you waiting for another review here?

@HuaHuaY

Copy link
Copy Markdown
ContributorAuthor

@HuaHuaY Are you waiting for another review here?

If there are no new comments, I think this PR is ok to be merged.

@HuaHuaY
HuaHuaYforce-pushed the nested_fixed_size_list_reader branch from c5cadcf to 3840ffcCompareJuly 22, 2026 16:09
Comment threadcpp/src/parquet/arrow/arrow_reader_writer_test.cc Outdated

@wgtmacwgtmac left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@wgtmac

Copy link
Copy Markdown
Member

I'll merge this tomorrow if no objection.

@thisisnic

Copy link
Copy Markdown
Member

@github-actions crossbow submit -g r

@thisisnic

Copy link
Copy Markdown
Member

I'll merge this tomorrow if no objection.

I've triggered the R builds just to make sure we don't have potential failures suggested in #50271 (comment)

@HuaHuaY

HuaHuaY commented Jul 27, 2026

Copy link
Copy Markdown
ContributorAuthor

I'll merge this tomorrow if no objection.

I've triggered the R builds just to make sure we don't have potential failures suggested in #50271 (comment)

It seems that no extra ci starts. I might be because @pitrou has added "CI: Extra R". R's CI has already been run.

@github-actions

Copy link
Copy Markdown

Revision: 06266f9

Submitted crossbow builds: ursacomputing/crossbow @ actions-d711fbc610

TaskStatus
r-binary-packagesGitHub Actions
r-recheck-mostGitHub Actions
test-r-alpine-linux-cranGitHub Actions
test-r-arrow-backwards-compatibilityGitHub Actions
test-r-depsource-systemGitHub Actions
test-r-dev-duckdbGitHub Actions
test-r-devdocsGitHub Actions
test-r-extra-packagesGitHub Actions
test-r-fedora-clangGitHub Actions
test-r-gcc-11GitHub Actions
test-r-gcc-12GitHub Actions
test-r-install-localGitHub Actions
test-r-install-local-minsizerelGitHub Actions
test-r-linux-as-cranGitHub Actions
test-r-linux-rchkGitHub Actions
test-r-linux-sanitizersGitHub Actions
test-r-linux-valgrindGitHub Actions
test-r-m1-sanGitHub Actions
test-r-macos-as-cranGitHub Actions
test-r-offline-maximalGitHub Actions
test-r-ubuntu-22.04GitHub Actions
test-r-versionsGitHub Actions
test-r-wasmGitHub Actions

@HuaHuaY

Copy link
Copy Markdown
ContributorAuthor

Oh. Extra CI starts. It just takes a little while to start up.

@HuaHuaY

HuaHuaY commented Jul 27, 2026

Copy link
Copy Markdown
ContributorAuthor

The additional CI run revealed an issue. Arrow recently introduced simdjson but hasn't updated this CI configuration yet. https://github.com/ursacomputing/crossbow/actions/runs/30279773748/job/90022897470

@HuaHuaY

Copy link
Copy Markdown
ContributorAuthor

I think these failures are unrelated to this PR. To be sure, I'll rebase and run it again.

@HuaHuaY
HuaHuaYforce-pushed the nested_fixed_size_list_reader branch from 06266f9 to 6b0bd58CompareJuly 28, 2026 02:47
@HuaHuaY

Copy link
Copy Markdown
ContributorAuthor

@github-actions crossbow submit -g r

@github-actions

Copy link
Copy Markdown
Only contributors can submit requests to this bot. Please ask someone from the community for help with getting the first commit in.
The Archery job run can be found at: https://github.com/apache/arrow/actions/runs/30324136965

@wgtmac

Copy link
Copy Markdown
Member

@github-actions crossbow submit -g r

@github-actions

Copy link
Copy Markdown

Revision: 6b0bd58

Submitted crossbow builds: ursacomputing/crossbow @ actions-523da37569

TaskStatus
r-binary-packagesGitHub Actions
r-recheck-mostGitHub Actions
test-r-alpine-linux-cranGitHub Actions
test-r-arrow-backwards-compatibilityGitHub Actions
test-r-depsource-systemGitHub Actions
test-r-dev-duckdbGitHub Actions
test-r-devdocsGitHub Actions
test-r-extra-packagesGitHub Actions
test-r-fedora-clangGitHub Actions
test-r-gcc-11GitHub Actions
test-r-gcc-12GitHub Actions
test-r-install-localGitHub Actions
test-r-install-local-minsizerelGitHub Actions
test-r-linux-as-cranGitHub Actions
test-r-linux-rchkGitHub Actions
test-r-linux-sanitizersGitHub Actions
test-r-linux-valgrindGitHub Actions
test-r-m1-sanGitHub Actions
test-r-macos-as-cranGitHub Actions
test-r-offline-maximalGitHub Actions
test-r-ubuntu-22.04GitHub Actions
test-r-versionsGitHub Actions
test-r-wasmGitHub Actions

@wgtmac

Copy link
Copy Markdown
Member

I've checked that all CI failures are unrelated.

@wgtmac
wgtmac merged commit 5e698fe into apache:mainJul 28, 2026
57 of 61 checks passed
@wgtmacwgtmac removed the awaiting change review Awaiting change review label Jul 28, 2026
@HuaHuaY
HuaHuaY deleted the nested_fixed_size_list_reader branch July 28, 2026 03:56
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 5e698fe.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 4 possible false positives for unstable benchmarks that are known to sometimes produce them.

kou pushed a commit that referenced this pull request Jul 30, 2026
)
### Rationale for this change
Fix#50636 - `test-r-macos-as-cran` nightly job fails compiling `visit({range_start, range_cur})` introduced in #50248.
```console
/Users/runner/work/crossbow/crossbow/arrow/cpp/src/arrow/compute/kernels/vector_sort.cc:325:11: note: candidate function not viable: cannot convert initializer list argument to 'std::span<uint64_t>' (aka 'span<unsigned long long>')
325 | [&](std::span<uint64_t> indices) { SortNextColumn(indices, offset); });
```
The job pins [macOS SDK 11.3](https://github.com/ursacomputing/crossbow/actions/runs/30420027426/job/90474737457#step:9:14), so libc++ there does not have C++20 iterator-pair span constructor available yet ([available with libc++ 14](https://libcxx.llvm.org/Status/Cxx20.html)).
Similar problem as in recent #50295
### What changes are included in this PR?
Replace std::span iterator-pair constructor with subspan in `vector_sort.cc`
Also replace std::ranges in `parquet/arrow/reader.cc` introduced in #50271
### Are these changes tested?
Yes, builds locally and crossbow `test-r-macos-as-cran` job succeeds.
### Are there any user-facing changes?
No.
* GitHub Issue: #50636
Authored-by: Tadeja Kadunc <tadeja.kadunc@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C++][Parquet] NotImplemented: Lists with non-zero length null components are not supported

4 participants

@HuaHuaY@pitrou@wgtmac@thisisnic