pub struct RowEventTimeExtractor { /* private fields */ }Expand description
Extracts event timestamps from EventRow fields.
Supports Int64 and TimestampMicros field types. Tracks the maximum
observed timestamp and computes a watermark with a configurable delay.
§Auto-Detection
When no explicit column is specified, from_schema
scans the schema for:
- A
TimestampMicrosfield (first one found) - A field named
ts,event_time, ortimestamp(case-insensitive)
If neither heuristic matches, returns None — the caller should use
a monotonic surrogate (row index).
Implementations§
Source§impl RowEventTimeExtractor
impl RowEventTimeExtractor
Sourcepub fn new(field_idx: usize, field_type: FieldType, delay: i64) -> Self
pub fn new(field_idx: usize, field_type: FieldType, delay: i64) -> Self
Creates an extractor for a known field index and type.
§Panics
Debug-asserts that field_type is Int64 or TimestampMicros.
Sourcepub fn from_schema(schema: &RowSchema, config: &EventTimeConfig) -> Option<Self>
pub fn from_schema(schema: &RowSchema, config: &EventTimeConfig) -> Option<Self>
Attempts to create an extractor by scanning the schema.
Uses the following strategy:
- If
config.columnisSome(name), look up that column exactly. - Otherwise, pick the first
TimestampMicrosfield. - Otherwise, pick a field named
ts,event_time, ortimestamp.
Returns None if no suitable field is found.
Sourcepub fn extract(&mut self, row: &EventRow<'_>) -> i64
pub fn extract(&mut self, row: &EventRow<'_>) -> i64
Extracts the event time from a row and updates the max timestamp.
Returns the raw timestamp value (microseconds or plain i64).
Sourcepub fn watermark(&self) -> i64
pub fn watermark(&self) -> i64
Returns the current watermark: max_timestamp - delay.
Returns i64::MIN if no timestamps have been observed.
Sourcepub fn max_timestamp(&self) -> i64
pub fn max_timestamp(&self) -> i64
Returns the maximum observed timestamp.
Sourcepub fn field_type(&self) -> FieldType
pub fn field_type(&self) -> FieldType
Returns the field type used for extraction.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RowEventTimeExtractor
impl RefUnwindSafe for RowEventTimeExtractor
impl Send for RowEventTimeExtractor
impl Sync for RowEventTimeExtractor
impl Unpin for RowEventTimeExtractor
impl UnsafeUnpin for RowEventTimeExtractor
impl UnwindSafe for RowEventTimeExtractor
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