Skip to content

Fix Fields::filter_leaves for ListView and LargeListView - #11657

Merged
Jefffrey merged 1 commit into
apache:mainfrom
patrickswedish:fix/filter-leaves-list-view-11612
Oct 18, 2026
Merged

Jefffrey merged 1 commit into
apache:mainfrom
patrickswedish:fix/filter-leaves-list-view-11612

Conversation

@patrickswedish

@patrickswedish patrickswedish commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #11612.

Rationale for this change

Fields::filter_leaves and Fields::try_filter_leaves perform a depth-first traversal over nested DataType variants so that the filter predicate is invoked only on leaf fields (fields with no children). Currently, try_filter_leaves handles DataType::List, DataType::LargeList, and DataType::FixedSizeList, but omits DataType::ListView and DataType::LargeListView, causing ListView and LargeListView fields to be treated as leaf fields instead of descending into their element FieldRef.

What changes are included in this PR?

  • Add DataType::ListView(child) and DataType::LargeListView(child) match arms in Fields::try_filter_leaves (arrow-schema/src/fields.rs) to recursively filter their child element field, matching the behavior of List and LargeList.
  • Add test_filter_list_view covering leaf filtering and leaf index counting across nested and primitive ListView and LargeListView fields.

Are there any user-facing changes?

Yes, Fields::filter_leaves and Fields::try_filter_leaves now properly descend into DataType::ListView and DataType::LargeListView child fields.


Diff minimization and pre-flight validation performed with ZeroSlop™ CI — Ribbsaeter Systems.

@github-actions github-actions Bot added arrow-core Core crates related to representing arrow data bug labels Oct 17, 2026
@Jefffrey
Jefffrey enabled auto-merge October 18, 2026 01:41
@Jefffrey

Copy link
Copy Markdown
Contributor

thanks

@Jefffrey
Jefffrey disabled auto-merge October 18, 2026 01:51

@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.

please ensure tests are run locally before submitting a PR

@patrickswedish
patrickswedish force-pushed the fix/filter-leaves-list-view-11612 branch from b04c849 to 4d9598e Compare October 18, 2026 02:00
@patrickswedish

patrickswedish commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Apologies for the oversight on the test constructor. Corrected the field initialization to DataType::ListView / DataType::LargeListView(Arc::new(...)) and verified clean compilation and cargo fmt locally.

@Jefffrey
Jefffrey enabled auto-merge October 18, 2026 02:14
@Jefffrey
Jefffrey added this pull request to the merge queue Oct 18, 2026
Merged via the queue into apache:main with commit a8306d6 Oct 18, 2026
35 checks passed

@comphead comphead 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.

Thanks I missed the PR

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 bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fields::filter_leaves treats ListView and LargeListView as leaves

3 participants