Skip to content

GH-55664: [Python] Fix tensor conversion with permutation - #55670

Open
09Catho wants to merge 1 commit into
apache:mainfrom
09Catho:fix/fixed-shape-tensor-permutation-55664
Open

09Catho wants to merge 1 commit into
apache:mainfrom
09Catho:fix/fixed-shape-tensor-permutation-55664

Conversation

@09Catho

@09Catho 09Catho commented Nov 18, 2026 •

Copy link
Copy Markdown

Rationale for this change

GH-55664 is a regression in Python conversion for fixed_shape_tensor types with a permutation. The current guard rejects empty, null, and flat-storage inputs before checking whether any element would need a transpose.

What changes are included in this PR?

The guard now rejects only multi-dimensional elements paired with a non-identity permutation. Identity permutations and inputs without a logical layout continue through the normal converter. The unsupported case now raises ArrowNotImplementedError. Regression coverage covers empty, null, flat-storage, identity-permutation, and rejected non-identity array inputs.

Are these changes tested?

  • Cython parsing of python/pyarrow/lib.pyx: passed.
  • Ruff check, Python test-file compilation, and git diff --check: passed.
  • The five issue cases pass against the installed PyArrow 18.1 control build.
  • The source pytest module could not be collected because this shallow checkout has no compiled pyarrow.lib extension.

Are there any user-facing changes?

Yes. These valid inputs work again, matching the behavior before the regression.

This PR contains a "Critical Fix".

Yes. The regression prevents construction of empty tables and records with tensor columns produced by FixedShapeTensorArray.from_numpy_ndarray.

Was AI used for this PR?

AI was used to prepare the initial patch and regression tests. The change was reviewed against the implementation, the issue reproducer, and the available local validation before submission.

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

Copilot AI balanced review requested due to automatic review settings November 18, 2026 12:50

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sign up for free to 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.

2 participants