pub struct ExprCompiler<'a> { /* private fields */ }Expand description
Compiles DataFusion expressions into native functions via Cranelift.
Borrows a JitContext (for the module/builder) and a RowSchema
(for field layout resolution). Each compile_* call produces one native
function.
Implementations§
Source§impl<'a> ExprCompiler<'a>
impl<'a> ExprCompiler<'a>
Sourcepub fn new(jit: &'a mut JitContext, schema: &'a RowSchema) -> Self
pub fn new(jit: &'a mut JitContext, schema: &'a RowSchema) -> Self
Creates a new compiler for the given JIT context and row schema.
Sourcepub fn compile_filter(&mut self, expr: &Expr) -> Result<FilterFn, CompileError>
pub fn compile_filter(&mut self, expr: &Expr) -> Result<FilterFn, CompileError>
Compiles a filter expression into a native FilterFn.
The generated function has signature fn(*const u8) -> u8 where the
argument is a pointer to an EventRow byte buffer. Returns 1 if the
row passes the filter, 0 otherwise. NULL filter results are treated
as false (row is rejected).
§Errors
Returns CompileError if the expression contains unsupported nodes.
§Panics
Panics if Cranelift fails to finalize function definitions (internal error).
Sourcepub fn compile_scalar(
&mut self,
expr: &Expr,
output_type: &FieldType,
) -> Result<ScalarFn, CompileError>
pub fn compile_scalar( &mut self, expr: &Expr, output_type: &FieldType, ) -> Result<ScalarFn, CompileError>
Compiles a scalar expression into a native ScalarFn.
The generated function has signature fn(*const u8, *mut u8) -> u8
where the first argument is a pointer to an EventRow byte buffer and
the second is a pointer to the output buffer. Returns 1 if the result
is null, 0 if valid.
§Errors
Returns CompileError if the expression contains unsupported nodes.
§Panics
Panics if Cranelift fails to finalize function definitions (internal error).
Auto Trait Implementations§
impl<'a> Freeze for ExprCompiler<'a>
impl<'a> !RefUnwindSafe for ExprCompiler<'a>
impl<'a> Send for ExprCompiler<'a>
impl<'a> !Sync for ExprCompiler<'a>
impl<'a> Unpin for ExprCompiler<'a>
impl<'a> UnsafeUnpin for ExprCompiler<'a>
impl<'a> !UnwindSafe for ExprCompiler<'a>
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more