Skip to content

refactor: separate extension validation - #12271

Open
Phoenix500526 wants to merge 1 commit into
apache:mainfrom
Phoenix500526:issue/9708
Open

Phoenix500526 wants to merge 1 commit into
apache:mainfrom
Phoenix500526:issue/9708

Conversation

@Phoenix500526

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

Checking whether a field has a valid fixed-shape tensor, variable-shape tensor, or WKB extension currently constructs an extension descriptor and discards it. JSON validation also creates a default descriptor solely to check the storage type.

What changes are included in this PR?

  • Share private validation helpers between try_new and validate for FixedShapeTensor, VariableShapeTensor, Json, and WkbType.
  • Extract the tensor metadata checks into private methods that borrow metadata. The constructors retain ownership of the original metadata without cloning it for validation.
  • Reuse the JSON and WKB helpers from supports_data_type.

The helpers allow constructors and validators to share checks while retaining the existing by-value validate signature. Removing the trait's default implementation is left for a separate API change.

Are these changes tested?

Existing tests cover construction, invalid metadata and storage types, and metadata round-trips. Added has_valid_extension_type assertions to the existing successful field tests, including all three JSON storage types and both metadata representations. No new test functions were added.

Are there any significant user-facing changes?

No public API signatures or accepted-input rules change. The default ExtensionType::validate implementation remains available for downstream implementations.

AI usage disclosure

Codex helped implement and review the refactor and test assertions, and run local validation.

Some extension checks construct descriptors only to discard them.
Keep validation independent of construction without changing the
ExtensionType contract.

Refs apache#9708
@boring-cyborg boring-cyborg Bot added arrow-core Core crates related to representing arrow data parquet Changes to the parquet crate labels Nov 16, 2026
@Phoenix500526
Phoenix500526 marked this pull request as ready for review November 16, 2026 06:50
@Phoenix500526

Copy link
Copy Markdown
Contributor Author

@sdf-jkl This PR is ready for review now. And CC @Rich-T-kid in case you're interested

@Rich-T-kid Rich-T-kid added the development-process Internal changes; PRs with this label are excluded from changelog label Nov 16, 2026

This branch has not been deployed

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

Labels

arrow-core Core crates related to representing arrow data development-process Internal changes; PRs with this label are excluded from changelog parquet Changes to the parquet crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants