1- use datafusion:: common:: { config_err, DataFusionError } ;
2- use datafusion:: config:: { ConfigEntry , ConfigExtension , ConfigField , ExtensionOptions , Visit } ;
3- use pyo3:: { pyclass, pymethods, Bound , PyResult , Python } ;
41use std:: any:: Any ;
2+
3+ use datafusion_common:: config:: {
4+ ConfigEntry , ConfigExtension , ConfigField , ExtensionOptions , Visit ,
5+ } ;
6+ use datafusion_common:: { DataFusionError , config_err} ;
57use datafusion_ffi:: config:: extension_options:: FFI_ExtensionOptions ;
68use pyo3:: exceptions:: PyRuntimeError ;
79use pyo3:: types:: PyCapsule ;
10+ use pyo3:: { Bound , PyResult , Python , pyclass, pymethods} ;
811
912/// My own config options.
1013#[ pyclass( name = "MyConfig" , module = "datafusion_ffi_example" , subclass) ]
@@ -24,15 +27,16 @@ impl MyConfig {
2427 Self :: default ( )
2528 }
2629
27-
2830 fn __datafusion_extension_options__ < ' py > (
2931 & self ,
3032 py : Python < ' py > ,
3133 ) -> PyResult < Bound < ' py , PyCapsule > > {
3234 let name = cr"datafusion_extension_options" . into ( ) ;
3335
3436 let mut config = FFI_ExtensionOptions :: default ( ) ;
35- config. add_config ( self ) . map_err ( |e| PyRuntimeError :: new_err ( e. to_string ( ) ) ) ?;
37+ config
38+ . add_config ( self )
39+ . map_err ( |e| PyRuntimeError :: new_err ( e. to_string ( ) ) ) ?;
3640
3741 PyCapsule :: new ( py, config, Some ( name) )
3842 }
@@ -64,8 +68,8 @@ impl ExtensionOptions for MyConfig {
6468 Box :: new ( self . clone ( ) )
6569 }
6670
67- fn set ( & mut self , key : & str , value : & str ) -> datafusion :: common :: Result < ( ) > {
68- datafusion :: config:: ConfigField :: set ( self , key, value)
71+ fn set ( & mut self , key : & str , value : & str ) -> datafusion_common :: Result < ( ) > {
72+ datafusion_common :: config:: ConfigField :: set ( self , key, value)
6973 }
7074
7175 fn entries ( & self ) -> Vec < ConfigEntry > {
@@ -103,6 +107,5 @@ impl ConfigField for MyConfig {
103107
104108 _ => config_err ! ( "Config value \" {}\" not found on MyConfig" , key) ,
105109 }
106-
107110 }
108111}
0 commit comments