@@ -19,13 +19,15 @@ use std::any::Any;
1919use std:: ffi:: c_void;
2020use std:: sync:: Arc ;
2121
22- use abi_stable:: StableAbi ;
23- use abi_stable:: std_types:: { ROption , RResult , RString , RVec } ;
2422use datafusion_catalog:: { CatalogProvider , SchemaProvider } ;
2523use datafusion_common:: error:: Result ;
2624use datafusion_proto:: logical_plan:: {
2725 DefaultLogicalExtensionCodec , LogicalExtensionCodec ,
2826} ;
27+ use stabby:: option:: Option as StabbyOption ;
28+ use stabby:: result:: Result as StabbyResult ;
29+ use stabby:: string:: String as StabbyString ;
30+ use stabby:: vec:: Vec as StabbyVec ;
2931use tokio:: runtime:: Handle ;
3032
3133use crate :: execution:: FFI_TaskContextProvider ;
@@ -36,28 +38,28 @@ use crate::{df_result, rresult_return};
3638
3739/// A stable struct for sharing [`CatalogProvider`] across FFI boundaries.
3840#[ repr( C ) ]
39- #[ derive( Debug , StableAbi ) ]
41+ #[ derive( Debug ) ]
4042pub struct FFI_CatalogProvider {
41- pub schema_names : unsafe extern "C" fn ( provider : & Self ) -> RVec < RString > ,
43+ pub schema_names : unsafe extern "C" fn ( provider : & Self ) -> StabbyVec < StabbyString > ,
4244
4345 pub schema : unsafe extern "C" fn (
4446 provider : & Self ,
45- name : RString ,
46- ) -> ROption < FFI_SchemaProvider > ,
47-
48- pub register_schema : unsafe extern "C" fn (
49- provider : & Self ,
50- name : RString ,
51- schema : & FFI_SchemaProvider ,
52- )
53- -> FFIResult < ROption < FFI_SchemaProvider > > ,
54-
55- pub deregister_schema : unsafe extern "C" fn (
56- provider : & Self ,
57- name : RString ,
58- cascade : bool ,
59- )
60- -> FFIResult < ROption < FFI_SchemaProvider > > ,
47+ name : StabbyString ,
48+ ) -> StabbyOption < FFI_SchemaProvider > ,
49+
50+ pub register_schema :
51+ unsafe extern "C" fn (
52+ provider : & Self ,
53+ name : StabbyString ,
54+ schema : & FFI_SchemaProvider ,
55+ ) -> FFIResult < StabbyOption < FFI_SchemaProvider > > ,
56+
57+ pub deregister_schema :
58+ unsafe extern "C" fn (
59+ provider : & Self ,
60+ name : StabbyString ,
61+ cascade : bool ,
62+ ) -> FFIResult < StabbyOption < FFI_SchemaProvider > > ,
6163
6264 pub logical_codec : FFI_LogicalExtensionCodec ,
6365
@@ -107,7 +109,7 @@ impl FFI_CatalogProvider {
107109
108110unsafe extern "C" fn schema_names_fn_wrapper (
109111 provider : & FFI_CatalogProvider ,
110- ) -> RVec < RString > {
112+ ) -> StabbyVec < StabbyString > {
111113 unsafe {
112114 let names = provider. inner ( ) . schema_names ( ) ;
113115 names. into_iter ( ) . map ( |s| s. into ( ) ) . collect ( )
@@ -116,8 +118,8 @@ unsafe extern "C" fn schema_names_fn_wrapper(
116118
117119unsafe extern "C" fn schema_fn_wrapper (
118120 provider : & FFI_CatalogProvider ,
119- name : RString ,
120- ) -> ROption < FFI_SchemaProvider > {
121+ name : StabbyString ,
122+ ) -> StabbyOption < FFI_SchemaProvider > {
121123 unsafe {
122124 let maybe_schema = provider. inner ( ) . schema ( name. as_str ( ) ) ;
123125 maybe_schema
@@ -134,9 +136,9 @@ unsafe extern "C" fn schema_fn_wrapper(
134136
135137unsafe extern "C" fn register_schema_fn_wrapper (
136138 provider : & FFI_CatalogProvider ,
137- name : RString ,
139+ name : StabbyString ,
138140 schema : & FFI_SchemaProvider ,
139- ) -> FFIResult < ROption < FFI_SchemaProvider > > {
141+ ) -> FFIResult < StabbyOption < FFI_SchemaProvider > > {
140142 unsafe {
141143 let runtime = provider. runtime ( ) ;
142144 let inner_provider = provider. inner ( ) ;
@@ -153,23 +155,23 @@ unsafe extern "C" fn register_schema_fn_wrapper(
153155 } )
154156 . into ( ) ;
155157
156- RResult :: ROk ( returned_schema)
158+ StabbyResult :: Ok ( returned_schema)
157159 }
158160}
159161
160162unsafe extern "C" fn deregister_schema_fn_wrapper (
161163 provider : & FFI_CatalogProvider ,
162- name : RString ,
164+ name : StabbyString ,
163165 cascade : bool ,
164- ) -> FFIResult < ROption < FFI_SchemaProvider > > {
166+ ) -> FFIResult < StabbyOption < FFI_SchemaProvider > > {
165167 unsafe {
166168 let runtime = provider. runtime ( ) ;
167169 let inner_provider = provider. inner ( ) ;
168170
169171 let maybe_schema =
170172 rresult_return ! ( inner_provider. deregister_schema( name. as_str( ) , cascade) ) ;
171173
172- RResult :: ROk (
174+ StabbyResult :: Ok (
173175 maybe_schema
174176 . map ( |schema| {
175177 FFI_SchemaProvider :: new_with_ffi_codec (
0 commit comments