Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions datafusion/functions/src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ pub fn functions() -> Vec<Arc<ScalarUDF>> {
nvl2(),
arrow_typeof(),
named_struct(),
get_field(),
Copy link
Contributor

Choose a reason for hiding this comment

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

It might help to add the context of why this function is exported. Perhaps something like

Suggested change
get_field(),
// Note most users invoke `get_field` indirectly via field access syntax
// like `my_struct_col['field_name']` results in a call to `get_field(my_struct_col, "field_name")`
// It is also exposed directly for use cases such as serializing / deserializing plans with
// the field access desugared to calls to `get_field`
get_field(),

Copy link
Contributor

Choose a reason for hiding this comment

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

Added in follow on PR: #11996

coalesce(),
]
}
8 changes: 8 additions & 0 deletions datafusion/sqllogictest/test_files/struct.slt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ select struct(a, b, c)['c1'] from values;
2.2
3.3

# explicit invocation of get_field
query R
select get_field(struct(a, b, c), 'c1') from values;
----
1.1
2.2
3.3

# struct scalar function #1
query ?
select struct(1, 3.14, 'e');
Expand Down