pub struct LookupJoinOperator { /* private fields */ }Expand description
Lookup join operator that enriches streaming events with external table data.
This operator caches lookup results in the state store to minimize external lookups. The cache uses processing-time-based TTL for expiration.
§Async Lookup Handling
Since the Operator trait is synchronous, async table lookups must be
handled externally. Use LookupJoinOperator::pending_lookups to get
keys that need to be looked up, and LookupJoinOperator::provide_lookup
to provide the results.
For simple synchronous use cases, use LookupJoinOperator::process_with_lookup
which accepts a closure for lookups.
Implementations§
Source§impl LookupJoinOperator
impl LookupJoinOperator
Sourcepub fn new(config: LookupJoinConfig) -> Self
pub fn new(config: LookupJoinConfig) -> Self
Creates a new lookup join operator.
Sourcepub fn with_id(config: LookupJoinConfig, operator_id: String) -> Self
pub fn with_id(config: LookupJoinConfig, operator_id: String) -> Self
Creates a new lookup join operator with explicit ID.
Sourcepub fn config(&self) -> &LookupJoinConfig
pub fn config(&self) -> &LookupJoinConfig
Returns the configuration.
Sourcepub fn metrics(&self) -> &LookupJoinMetrics
pub fn metrics(&self) -> &LookupJoinMetrics
Returns the metrics.
Sourcepub fn reset_metrics(&mut self)
pub fn reset_metrics(&mut self)
Resets the metrics.
Sourcepub fn pending_lookups(&self) -> &[Vec<u8>]
pub fn pending_lookups(&self) -> &[Vec<u8>]
Returns keys that need external lookup.
After processing events, check this for keys that weren’t in the cache.
Provide lookup results via provide_lookup.
Sourcepub fn provide_lookup(
&mut self,
key: &[u8],
result: Option<&RecordBatch>,
ctx: &mut OperatorContext<'_>,
) -> OutputVec
pub fn provide_lookup( &mut self, key: &[u8], result: Option<&RecordBatch>, ctx: &mut OperatorContext<'_>, ) -> OutputVec
Provides a lookup result for a pending key.
Call this after performing the async lookup to complete processing of pending events.
§Returns
Output events that can now be emitted after the lookup result is available.
Sourcepub fn process_with_lookup<F>(
&mut self,
event: &Event,
ctx: &mut OperatorContext<'_>,
lookup_fn: F,
) -> OutputVec
pub fn process_with_lookup<F>( &mut self, event: &Event, ctx: &mut OperatorContext<'_>, lookup_fn: F, ) -> OutputVec
Processes an event with a synchronous lookup function.
This is a convenience method for cases where lookups can be done synchronously (e.g., from an in-memory table).
Trait Implementations§
Source§impl Operator for LookupJoinOperator
impl Operator for LookupJoinOperator
Source§fn process(&mut self, event: &Event, ctx: &mut OperatorContext<'_>) -> OutputVec
fn process(&mut self, event: &Event, ctx: &mut OperatorContext<'_>) -> OutputVec
Source§fn on_timer(&mut self, timer: Timer, ctx: &mut OperatorContext<'_>) -> OutputVec
fn on_timer(&mut self, timer: Timer, ctx: &mut OperatorContext<'_>) -> OutputVec
Source§fn checkpoint(&self) -> OperatorState
fn checkpoint(&self) -> OperatorState
Source§fn restore(&mut self, state: OperatorState) -> Result<(), OperatorError>
fn restore(&mut self, state: OperatorState) -> Result<(), OperatorError>
Auto Trait Implementations§
impl Freeze for LookupJoinOperator
impl !RefUnwindSafe for LookupJoinOperator
impl Send for LookupJoinOperator
impl Sync for LookupJoinOperator
impl Unpin for LookupJoinOperator
impl !UnwindSafe for LookupJoinOperator
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.