Add:arrow_metadata() UDF - #19435
Merged
Merged
Conversation
Jefffrey
reviewed
Dec 21, 2025
Jefffrey
left a comment
Contributor
There was a problem hiding this comment.
I think we just need to add some documentation, see an example from arrow_typeof here:
datafusion/datafusion/functions/src/core/arrowtypeof.rs
Lines 25 to 42 in 2c3566c
Contributor
Author
|
@Jefffrey Done. |
Jefffrey
approved these changes
Dec 21, 2025
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Apr 14, 2026
## Which issue does this PR close? - Related to #21387 and #19435 ## Rationale for this change DataFusion has individual introspection functions (`arrow_typeof`, `arrow_metadata`, `is_nullable`) but no single function that returns the complete Arrow `Field` representation. Having `arrow_field(expr)` that returns a struct with all field info avoids multiple function calls when you need the full picture, and provides a natural complement to the existing introspection suite. ## What changes are included in this PR? Adds `arrow_field(expr)` scalar UDF that returns a struct: ```sql > SELECT arrow_field(x) FROM my_table; {name: x, data_type: Int32, nullable: false, metadata: {}} > SELECT arrow_field(x)['data_type'] FROM my_table; Int32 ``` The returned struct has four fields: - `name` (Utf8) — the field name - `data_type` (Utf8) — the Arrow data type as string - `nullable` (Boolean) — whether the field is nullable - `metadata` (Map<Utf8, Utf8>) — the field metadata Individual fields are accessible via bracket syntax. **Files:** - `datafusion/functions/src/core/arrow_field.rs` — new UDF implementation - `datafusion/functions/src/core/mod.rs` — registration - `datafusion/sqllogictest/test_files/arrow_field.slt` — tests ## Are these changes tested? Yes, sqllogictest covering literals (int, null, bool, string, float, list), table columns, nullability, and struct field access. ## Are there any user-facing changes? New SQL function `arrow_field(expr)` is available. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
coderfender
pushed a commit
to coderfender/datafusion
that referenced
this pull request
Apr 14, 2026
## Which issue does this PR close? - Related to apache#21387 and apache#19435 ## Rationale for this change DataFusion has individual introspection functions (`arrow_typeof`, `arrow_metadata`, `is_nullable`) but no single function that returns the complete Arrow `Field` representation. Having `arrow_field(expr)` that returns a struct with all field info avoids multiple function calls when you need the full picture, and provides a natural complement to the existing introspection suite. ## What changes are included in this PR? Adds `arrow_field(expr)` scalar UDF that returns a struct: ```sql > SELECT arrow_field(x) FROM my_table; {name: x, data_type: Int32, nullable: false, metadata: {}} > SELECT arrow_field(x)['data_type'] FROM my_table; Int32 ``` The returned struct has four fields: - `name` (Utf8) — the field name - `data_type` (Utf8) — the Arrow data type as string - `nullable` (Boolean) — whether the field is nullable - `metadata` (Map<Utf8, Utf8>) — the field metadata Individual fields are accessible via bracket syntax. **Files:** - `datafusion/functions/src/core/arrow_field.rs` — new UDF implementation - `datafusion/functions/src/core/mod.rs` — registration - `datafusion/sqllogictest/test_files/arrow_field.slt` — tests ## Are these changes tested? Yes, sqllogictest covering literals (int, null, bool, string, float, list), table columns, nullability, and struct field access. ## Are there any user-facing changes? New SQL function `arrow_field(expr)` is available. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
Rich-T-kid
pushed a commit
to Rich-T-kid/datafusion
that referenced
this pull request
Apr 21, 2026
## Which issue does this PR close? - Related to apache#21387 and apache#19435 ## Rationale for this change DataFusion has individual introspection functions (`arrow_typeof`, `arrow_metadata`, `is_nullable`) but no single function that returns the complete Arrow `Field` representation. Having `arrow_field(expr)` that returns a struct with all field info avoids multiple function calls when you need the full picture, and provides a natural complement to the existing introspection suite. ## What changes are included in this PR? Adds `arrow_field(expr)` scalar UDF that returns a struct: ```sql > SELECT arrow_field(x) FROM my_table; {name: x, data_type: Int32, nullable: false, metadata: {}} > SELECT arrow_field(x)['data_type'] FROM my_table; Int32 ``` The returned struct has four fields: - `name` (Utf8) — the field name - `data_type` (Utf8) — the Arrow data type as string - `nullable` (Boolean) — whether the field is nullable - `metadata` (Map<Utf8, Utf8>) — the field metadata Individual fields are accessible via bracket syntax. **Files:** - `datafusion/functions/src/core/arrow_field.rs` — new UDF implementation - `datafusion/functions/src/core/mod.rs` — registration - `datafusion/sqllogictest/test_files/arrow_field.slt` — tests ## Are these changes tested? Yes, sqllogictest covering literals (int, null, bool, string, float, list), table columns, nullability, and struct field access. ## Are there any user-facing changes? New SQL function `arrow_field(expr)` is available. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #19356
Rationale for this change
This PR implements the arrow_metadata UDF as requested in issue #19356.
What changes are included in this PR?
Added arrow_metadata UDF
Refactored Tests
Are these changes tested?
Yes.
Are there any user-facing changes?
Yes.