#[repr(C)]pub struct FFI_TableProvider {
pub schema: unsafe extern "C" fn(provider: &Self) -> WrappedSchema,
pub scan: unsafe extern "C" fn(provider: &Self, session_config: &FFI_SessionConfig, projections: RVec<usize>, filters_serialized: RVec<u8>, limit: ROption<usize>) -> FfiFuture<RResult<FFI_ExecutionPlan, RString>>,
pub table_type: unsafe extern "C" fn(provider: &Self) -> FFI_TableType,
pub supports_filters_pushdown: Option<unsafe extern "C" fn(provider: &FFI_TableProvider, filters_serialized: RVec<u8>) -> RResult<RVec<FFI_TableProviderFilterPushDown>, RString>>,
pub insert_into: unsafe extern "C" fn(provider: &Self, session_config: &FFI_SessionConfig, input: &FFI_ExecutionPlan, insert_op: FFI_InsertOp) -> FfiFuture<RResult<FFI_ExecutionPlan, RString>>,
pub clone: unsafe extern "C" fn(plan: &Self) -> Self,
pub release: unsafe extern "C" fn(arg: &mut Self),
pub version: unsafe extern "C" fn() -> u64,
pub private_data: *mut c_void,
}Expand description
A stable struct for sharing TableProvider across FFI boundaries.
§Struct Layout
The following description applies to all structs provided in this crate.
Each of the exposed structs in this crate is provided with a variant prefixed
with Foreign. This variant is designed to be used by the consumer of the
foreign code. The Foreign structs should never access the private_data
fields. Instead they should only access the data returned through the function
calls defined on the FFI_ structs. The second purpose of the Foreign
structs is to contain additional data that may be needed by the traits that
are implemented on them. Some of these traits require borrowing data which
can be far more convenient to be locally stored.
For example, we have a struct FFI_TableProvider to give access to the
TableProvider functions like table_type() and scan(). If we write a
library that wishes to expose it’s TableProvider, then we can access the
private data that contains the Arc reference to the TableProvider via
FFI_TableProvider. This data is local to the library.
If we have a program that accesses a TableProvider via FFI, then it
will use ForeignTableProvider. When using ForeignTableProvider we must
not attempt to access the private_data field in FFI_TableProvider. If a
user is testing locally, you may be able to successfully access this field, but
it will only work if you are building against the exact same version of
DataFusion for both libraries and the same compiler. It will not work
in general.
It is worth noting that which library is the local and which is foreign
depends on which interface we are considering. For example, suppose we have a
Python library called my_provider that exposes a TableProvider called
MyProvider via FFI_TableProvider. Within the library my_provider we can
access the private_data via FFI_TableProvider. We connect this to
datafusion-python, where we access it as a ForeignTableProvider. Now when
we call scan() on this interface, we have to pass it a FFI_SessionConfig.
The SessionConfig is local to datafusion-python and not my_provider.
It is important to be careful when expanding these functions to be certain which
side of the interface each object refers to.
Fields§
§schema: unsafe extern "C" fn(provider: &Self) -> WrappedSchemaReturn the table schema
scan: unsafe extern "C" fn(provider: &Self, session_config: &FFI_SessionConfig, projections: RVec<usize>, filters_serialized: RVec<u8>, limit: ROption<usize>) -> FfiFuture<RResult<FFI_ExecutionPlan, RString>>Perform a scan on the table. See TableProvider for detailed usage information.
§Arguments
provider- the table providersession_config- session configurationprojections- if specified, only a subset of the columns are returnedfilters_serialized- filters to apply to the scan, which are aLogicalExprListprotobuf message serialized into bytes to pass across the FFI boundary.limit- if specified, limit the number of rows returned
table_type: unsafe extern "C" fn(provider: &Self) -> FFI_TableTypeReturn the type of table. See TableType for options.
supports_filters_pushdown: Option<unsafe extern "C" fn(provider: &FFI_TableProvider, filters_serialized: RVec<u8>) -> RResult<RVec<FFI_TableProviderFilterPushDown>, RString>>Based upon the input filters, identify which are supported. The filters
are a LogicalExprList protobuf message serialized into bytes to pass
across the FFI boundary.
insert_into: unsafe extern "C" fn(provider: &Self, session_config: &FFI_SessionConfig, input: &FFI_ExecutionPlan, insert_op: FFI_InsertOp) -> FfiFuture<RResult<FFI_ExecutionPlan, RString>>§clone: unsafe extern "C" fn(plan: &Self) -> SelfUsed to create a clone on the provider of the execution plan. This should only need to be called by the receiver of the plan.
release: unsafe extern "C" fn(arg: &mut Self)Release the memory of the private data when it is no longer being used.
version: unsafe extern "C" fn() -> u64Return the major DataFusion version number of this provider.
private_data: *mut c_voidInternal data. This is only to be accessed by the provider of the plan.
A ForeignExecutionPlan should never attempt to access this data.
Implementations§
Source§impl FFI_TableProvider
impl FFI_TableProvider
Sourcepub fn new(
provider: Arc<dyn TableProvider + Send>,
can_support_pushdown_filters: bool,
runtime: Option<Handle>,
) -> Self
pub fn new( provider: Arc<dyn TableProvider + Send>, can_support_pushdown_filters: bool, runtime: Option<Handle>, ) -> Self
Creates a new FFI_TableProvider.
Trait Implementations§
Source§impl Clone for FFI_TableProvider
impl Clone for FFI_TableProvider
Source§impl Debug for FFI_TableProvider
impl Debug for FFI_TableProvider
Source§impl Drop for FFI_TableProvider
impl Drop for FFI_TableProvider
Source§impl From<&FFI_TableProvider> for ForeignTableProvider
impl From<&FFI_TableProvider> for ForeignTableProvider
Source§fn from(provider: &FFI_TableProvider) -> Self
fn from(provider: &FFI_TableProvider) -> Self
Source§impl GetStaticEquivalent_ for FFI_TableProvider
impl GetStaticEquivalent_ for FFI_TableProvider
Source§type StaticEquivalent = _static_FFI_TableProvider
type StaticEquivalent = _static_FFI_TableProvider
'static equivalent of SelfSource§impl StableAbi for FFI_TableProvider
impl StableAbi for FFI_TableProvider
Source§const LAYOUT: &'static TypeLayout
const LAYOUT: &'static TypeLayout
Source§type IsNonZeroType = False
type IsNonZeroType = False
Source§const ABI_CONSTS: AbiConsts = _
const ABI_CONSTS: AbiConsts = _
const-equivalents of the associated types.impl Send for FFI_TableProvider
impl Sync for FFI_TableProvider
Auto Trait Implementations§
impl Freeze for FFI_TableProvider
impl RefUnwindSafe for FFI_TableProvider
impl Unpin for FFI_TableProvider
impl UnwindSafe for FFI_TableProvider
Blanket Implementations§
Source§impl<T> AlignerFor<1> for T
impl<T> AlignerFor<1> for T
Source§impl<T> AlignerFor<1024> for T
impl<T> AlignerFor<1024> for T
Source§type Aligner = AlignTo1024<T>
type Aligner = AlignTo1024<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<128> for T
impl<T> AlignerFor<128> for T
Source§type Aligner = AlignTo128<T>
type Aligner = AlignTo128<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<16> for T
impl<T> AlignerFor<16> for T
Source§impl<T> AlignerFor<16384> for T
impl<T> AlignerFor<16384> for T
Source§type Aligner = AlignTo16384<T>
type Aligner = AlignTo16384<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<2> for T
impl<T> AlignerFor<2> for T
Source§impl<T> AlignerFor<2048> for T
impl<T> AlignerFor<2048> for T
Source§type Aligner = AlignTo2048<T>
type Aligner = AlignTo2048<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<256> for T
impl<T> AlignerFor<256> for T
Source§type Aligner = AlignTo256<T>
type Aligner = AlignTo256<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<32> for T
impl<T> AlignerFor<32> for T
Source§impl<T> AlignerFor<32768> for T
impl<T> AlignerFor<32768> for T
Source§type Aligner = AlignTo32768<T>
type Aligner = AlignTo32768<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<4> for T
impl<T> AlignerFor<4> for T
Source§impl<T> AlignerFor<4096> for T
impl<T> AlignerFor<4096> for T
Source§type Aligner = AlignTo4096<T>
type Aligner = AlignTo4096<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<512> for T
impl<T> AlignerFor<512> for T
Source§type Aligner = AlignTo512<T>
type Aligner = AlignTo512<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<64> for T
impl<T> AlignerFor<64> for T
Source§impl<T> AlignerFor<8> for T
impl<T> AlignerFor<8> for T
Source§impl<T> AlignerFor<8192> for T
impl<T> AlignerFor<8192> for T
Source§type Aligner = AlignTo8192<T>
type Aligner = AlignTo8192<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<'a, T> RCowCompatibleRef<'a> for Twhere
T: Clone + 'a,
impl<'a, T> RCowCompatibleRef<'a> for Twhere
T: Clone + 'a,
Source§fn as_c_ref(from: &'a T) -> <T as RCowCompatibleRef<'a>>::RefC
fn as_c_ref(from: &'a T) -> <T as RCowCompatibleRef<'a>>::RefC
Source§fn as_rust_ref(from: <T as RCowCompatibleRef<'a>>::RefC) -> &'a T
fn as_rust_ref(from: <T as RCowCompatibleRef<'a>>::RefC) -> &'a T
Source§impl<S> ROExtAcc for S
impl<S> ROExtAcc for S
Source§fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
offset. Read moreSource§fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
offset. Read moreSource§fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
offset. Read moreSource§fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
offset. Read moreSource§impl<S> ROExtOps<Aligned> for S
impl<S> ROExtOps<Aligned> for S
Source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
offset) with value,
returning the previous value of the field. Read moreSource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
Source§impl<S> ROExtOps<Unaligned> for S
impl<S> ROExtOps<Unaligned> for S
Source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
offset) with value,
returning the previous value of the field. Read moreSource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
Source§impl<T> SelfOps for Twhere
T: ?Sized,
impl<T> SelfOps for Twhere
T: ?Sized,
Source§fn piped<F, U>(self, f: F) -> U
fn piped<F, U>(self, f: F) -> U
Source§fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
piped except that the function takes &Self
Useful for functions that take &Self instead of Self. Read moreSource§fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
piped, except that the function takes &mut Self.
Useful for functions that take &mut Self instead of Self.Source§fn mutated<F>(self, f: F) -> Self
fn mutated<F>(self, f: F) -> Self
Source§fn observe<F>(self, f: F) -> Self
fn observe<F>(self, f: F) -> Self
Source§fn as_ref_<T>(&self) -> &T
fn as_ref_<T>(&self) -> &T
AsRef,
using the turbofish .as_ref_::<_>() syntax. Read moreSource§impl<This> TransmuteElement for Thiswhere
This: ?Sized,
impl<This> TransmuteElement for Thiswhere
This: ?Sized,
Source§unsafe fn transmute_element<T>(self) -> Self::TransmutedPtrwhere
Self: CanTransmuteElement<T>,
unsafe fn transmute_element<T>(self) -> Self::TransmutedPtrwhere
Self: CanTransmuteElement<T>,
Source§impl<T> TypeIdentity for Twhere
T: ?Sized,
impl<T> TypeIdentity for Twhere
T: ?Sized,
Source§fn as_type_mut(&mut self) -> &mut Self::Type
fn as_type_mut(&mut self) -> &mut Self::Type
Source§fn into_type_box(self: Box<Self>) -> Box<Self::Type>
fn into_type_box(self: Box<Self>) -> Box<Self::Type>
alloc only.Source§fn into_type_arc(this: Arc<Self>) -> Arc<Self::Type>
fn into_type_arc(this: Arc<Self>) -> Arc<Self::Type>
alloc only.Source§fn into_type_rc(this: Rc<Self>) -> Rc<Self::Type>
fn into_type_rc(this: Rc<Self>) -> Rc<Self::Type>
alloc only.Source§fn from_type_ref(this: &Self::Type) -> &Self
fn from_type_ref(this: &Self::Type) -> &Self
Source§fn from_type_mut(this: &mut Self::Type) -> &mut Self
fn from_type_mut(this: &mut Self::Type) -> &mut Self
Source§fn from_type_box(this: Box<Self::Type>) -> Box<Self>
fn from_type_box(this: Box<Self::Type>) -> Box<Self>
alloc only.