Skip to content

Commit

Permalink
register get_field by default (#11959)
Browse files Browse the repository at this point in the history
This makes sense in principle, as all other core
udfs are register by default in the context.

It also has a practical use, which is executing
logical plans that have field access already de-sugared
into get_field invocations.
  • Loading branch information
leoyvens authored Aug 14, 2024
1 parent 69c99a7 commit 482ef45
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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(),
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

0 comments on commit 482ef45

Please sign in to comment.