Skip to content

Commit 482ef45

Browse files
authored
register get_field by default (#11959)
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.
1 parent 69c99a7 commit 482ef45

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

datafusion/functions/src/core/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ pub fn functions() -> Vec<Arc<ScalarUDF>> {
9494
nvl2(),
9595
arrow_typeof(),
9696
named_struct(),
97+
get_field(),
9798
coalesce(),
9899
]
99100
}

datafusion/sqllogictest/test_files/struct.slt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ select struct(a, b, c)['c1'] from values;
7272
2.2
7373
3.3
7474

75+
# explicit invocation of get_field
76+
query R
77+
select get_field(struct(a, b, c), 'c1') from values;
78+
----
79+
1.1
80+
2.2
81+
3.3
82+
7583
# struct scalar function #1
7684
query ?
7785
select struct(1, 3.14, 'e');

0 commit comments

Comments
 (0)