Skip to content

Return PyValueError for nullable PyArrow struct imports#10174

Merged
alamb merged 2 commits into
apache:mainfrom
fallintoplace:fix-pyarrow-nullable-struct-error
Jun 23, 2026
Merged

Return PyValueError for nullable PyArrow struct imports#10174
alamb merged 2 commits into
apache:mainfrom
fallintoplace:fix-pyarrow-nullable-struct-error

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

What changed

RecordBatch::from_pyarrow_bound now returns a PyValueError when a PyArrow C array capsule contains a nullable top-level StructArray, instead of panicking via an internal assertion.

A regression test covers importing a nullable PyArrow struct array through the capsule path.

Why

This conversion handles external Python input, so unsupported nullable struct arrays should surface as Python exceptions rather than aborting through a Rust panic.

Validation

  • cargo fmt --package arrow-pyarrow
  • cargo fmt --manifest-path arrow-pyarrow-testing/Cargo.toml
  • cargo test --manifest-path arrow-pyarrow-testing/Cargo.toml test_from_pyarrow_nullable_struct_array

@Jefffrey Jefffrey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should be good once merge conflict is resolved

…nullable-struct-error

# Conflicts:
#	arrow-pyarrow-testing/tests/pyarrow.rs
@alamb

alamb commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

I took the liberty of merging up from main

@alamb alamb merged commit 6ba533d into apache:main Jun 23, 2026
13 checks passed
@alamb

alamb commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Thanks again @fallintoplace and @Jefffrey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants