Skip to content

[Variant] VariantArray field API naming#10124

Merged
scovich merged 4 commits into
apache:mainfrom
sdf-jkl:variant-api-rename
Jun 16, 2026
Merged

[Variant] VariantArray field API naming#10124
scovich merged 4 commits into
apache:mainfrom
sdf-jkl:variant-api-rename

Conversation

@sdf-jkl

@sdf-jkl sdf-jkl commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

check issue

What changes are included in this PR?

  • Rename existing _field APIs that return &ArrayRef to _column
  • Add new _field APIs that return &FieldRef and tests for them

Are these changes tested?

  • Yes, unit tests

Are there any user-facing changes?

  • Yes, breaking API name change.

@github-actions github-actions Bot added the parquet-variant parquet-variant* crates label Jun 11, 2026
self.shredding_state.typed_value_column()
}

/// Return the [`FieldRef`] of the `metadata` column of the [`StructArray`]

@sdf-jkl sdf-jkl Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Now that I look at it the new _field APIs would only be used for tests in #10015.

  // before reuse StructArray::field_by_name (#10110), returns Option<&FieldRef>
  let typed_value_field = variant_array.inner().field_by_name("typed_value").unwrap();
  
  // new — the new VariantArray sugar, returns Option<&FieldRef> (no .inner(), no magic string)
  let typed_value_field = variant_array.typed_value_field().unwrap();

Is it worth introducing for 4 calls in tests?

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 curious where metadata_field and value_field will be used, since it seems their fields are fixed? If we don't need them, maybe we can add later when necessary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree, I think they are not that necessary. typed_value_field may go too.

@sdf-jkl

sdf-jkl commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

@alamb @scovich @klion26 PTAL

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

LGTM, thanks for the contribution

self.shredding_state.typed_value_column()
}

/// Return the [`FieldRef`] of the `metadata` column of the [`StructArray`]

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 curious where metadata_field and value_field will be used, since it seems their fields are fixed? If we don't need them, maybe we can add later when necessary?

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

LGTM, but it sounds like we probably don't need the xxx_field methods (yet)?
Should we update the PR accordingly before merge?

@sdf-jkl

sdf-jkl commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

@scovich done. :shipit:

@scovich scovich merged commit 78ca92d into apache:main Jun 16, 2026
17 checks passed
@sdf-jkl sdf-jkl deleted the variant-api-rename branch June 16, 2026 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parquet-variant parquet-variant* crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Variant] VariantArray field API naming

3 participants