@@ -932,6 +932,7 @@ pub struct SessionStateBuilder {
932932 scalar_functions : Option < Vec < Arc < ScalarUDF > > > ,
933933 aggregate_functions : Option < Vec < Arc < AggregateUDF > > > ,
934934 window_functions : Option < Vec < Arc < WindowUDF > > > ,
935+ extension_types : Option < Vec < LogicalTypeRef > > ,
935936 serializer_registry : Option < Arc < dyn SerializerRegistry > > ,
936937 file_formats : Option < Vec < Arc < dyn FileFormatFactory > > > ,
937938 config : Option < SessionConfig > ,
@@ -969,6 +970,7 @@ impl SessionStateBuilder {
969970 scalar_functions : None ,
970971 aggregate_functions : None ,
971972 window_functions : None ,
973+ extension_types : None ,
972974 serializer_registry : None ,
973975 file_formats : None ,
974976 table_options : None ,
@@ -1021,6 +1023,7 @@ impl SessionStateBuilder {
10211023 existing. aggregate_functions . into_values ( ) . collect_vec ( ) ,
10221024 ) ,
10231025 window_functions : Some ( existing. window_functions . into_values ( ) . collect_vec ( ) ) ,
1026+ extension_types : Some ( existing. extension_types . all_types ( ) ) ,
10241027 serializer_registry : Some ( existing. serializer_registry ) ,
10251028 file_formats : Some ( existing. file_formats . into_values ( ) . collect_vec ( ) ) ,
10261029 config : Some ( new_config) ,
@@ -1407,6 +1410,7 @@ impl SessionStateBuilder {
14071410 scalar_functions : HashMap :: new ( ) ,
14081411 aggregate_functions : HashMap :: new ( ) ,
14091412 window_functions : HashMap :: new ( ) ,
1413+ extension_types : MemoryExtensionTypeRegistry :: new ( ) ,
14101414 serializer_registry : serializer_registry
14111415 . unwrap_or_else ( || Arc :: new ( EmptySerializerRegistry ) ) ,
14121416 file_formats : HashMap :: new ( ) ,
@@ -1456,6 +1460,15 @@ impl SessionStateBuilder {
14561460 } ) ;
14571461 }
14581462
1463+ if let Some ( extension_types) = extension_types {
1464+ extension_types. into_iter ( ) . for_each ( |ext_type| {
1465+ let existing_type = state. register_extension_type ( ext_type) ;
1466+ if let Ok ( Some ( existing_type) ) = existing_type {
1467+ debug ! ( "Overwrote an existing UDF: {}" , existing_type) ;
1468+ }
1469+ } ) ;
1470+ }
1471+
14591472 if state. config . create_default_catalog_and_schema ( ) {
14601473 let default_catalog = SessionStateDefaults :: default_catalog (
14611474 & state. config ,
0 commit comments