risingwave_stream::executor::hash_join

Struct HashJoinExecutor

source
pub struct HashJoinExecutor<K: HashKey, S: StateStore, const T: u8> {
Show 17 fields ctx: ActorContextRef, info: ExecutorInfo, input_l: Option<Executor>, input_r: Option<Executor>, actual_output_data_types: Vec<DataType>, side_l: JoinSide<K, S>, side_r: JoinSide<K, S>, cond: Option<NonStrictExpression>, inequality_pairs: Vec<(Vec<usize>, Option<NonStrictExpression>)>, inequality_watermarks: Vec<Option<Watermark>>, append_only_optimize: bool, metrics: Arc<StreamingMetrics>, chunk_size: usize, cnt_rows_received: u32, watermark_buffers: BTreeMap<usize, BufferedWatermarks<u8>>, high_join_amplification_threshold: usize, entry_state_max_rows: usize,
}
Expand description

HashJoinExecutor takes two input streams and runs equal hash join on them. The output columns are the concatenation of left and right columns.

Fields§

§ctx: ActorContextRef§info: ExecutorInfo§input_l: Option<Executor>

Left input executor

§input_r: Option<Executor>

Right input executor

§actual_output_data_types: Vec<DataType>

The data types of the formed new columns

§side_l: JoinSide<K, S>

The parameters of the left join executor

§side_r: JoinSide<K, S>

The parameters of the right join executor

§cond: Option<NonStrictExpression>

Optional non-equi join conditions

§inequality_pairs: Vec<(Vec<usize>, Option<NonStrictExpression>)>

Column indices of watermark output and offset expression of each inequality, respectively.

§inequality_watermarks: Vec<Option<Watermark>>

The output watermark of each inequality condition and its value is the minimum of the calculation result of both side. It will be used to generate watermark into downstream and do state cleaning if clean_state field of that inequality is true.

§append_only_optimize: bool

Whether the logic can be optimized for append-only stream

§metrics: Arc<StreamingMetrics>§chunk_size: usize

The maximum size of the chunk produced by executor at a time

§cnt_rows_received: u32

Count the messages received, clear to 0 when counted to EVICT_EVERY_N_MESSAGES

§watermark_buffers: BTreeMap<usize, BufferedWatermarks<u8>>

watermark column index -> BufferedWatermarks

§high_join_amplification_threshold: usize

When to alert high join amplification

§entry_state_max_rows: usize

Max number of rows that will be cached in the entry state.

Implementations§

source§

impl<K: HashKey, S: StateStore, const T: u8> HashJoinExecutor<K, S, T>

source

pub fn new( ctx: ActorContextRef, info: ExecutorInfo, input_l: Executor, input_r: Executor, params_l: JoinParams, params_r: JoinParams, null_safe: Vec<bool>, output_indices: Vec<usize>, cond: Option<NonStrictExpression>, inequality_pairs: Vec<(usize, usize, bool, Option<NonStrictExpression>)>, state_table_l: StateTable<S>, degree_state_table_l: StateTable<S>, state_table_r: StateTable<S>, degree_state_table_r: StateTable<S>, watermark_epoch: AtomicU64Ref, is_append_only: bool, metrics: Arc<StreamingMetrics>, chunk_size: usize, high_join_amplification_threshold: usize, ) -> Self

source

pub fn new_with_cache_size( ctx: ActorContextRef, info: ExecutorInfo, input_l: Executor, input_r: Executor, params_l: JoinParams, params_r: JoinParams, null_safe: Vec<bool>, output_indices: Vec<usize>, cond: Option<NonStrictExpression>, inequality_pairs: Vec<(usize, usize, bool, Option<NonStrictExpression>)>, state_table_l: StateTable<S>, degree_state_table_l: StateTable<S>, state_table_r: StateTable<S>, degree_state_table_r: StateTable<S>, watermark_epoch: AtomicU64Ref, is_append_only: bool, metrics: Arc<StreamingMetrics>, chunk_size: usize, high_join_amplification_threshold: usize, entry_state_max_rows: Option<usize>, ) -> Self

source

fn into_stream(self) -> impl Stream<Item = Result<Message, StreamExecutorError>>

source

async fn flush_data( &mut self, epoch: EpochPair, ) -> StreamExecutorResult<(JoinHashMapPostCommit<'_, K, S>, JoinHashMapPostCommit<'_, K, S>)>

source

async fn try_flush_data(&mut self) -> StreamExecutorResult<()>

source

fn evict_cache( side_update: &mut JoinSide<K, S>, side_match: &mut JoinSide<K, S>, cnt_rows_received: &mut u32, )

source

async fn handle_watermark( &mut self, side: u8, watermark: Watermark, ) -> StreamExecutorResult<Vec<Watermark>>

source

fn row_concat( row_update: impl Row, update_start_pos: usize, row_matched: impl Row, matched_start_pos: usize, ) -> OwnedRow

source

fn eq_join_left( args: EqJoinArgs<'_, K, S>, ) -> impl Stream<Item = Result<StreamChunk, StreamExecutorError>> + '_

Used to forward eq_join_oneside to show join side in stack.

source

fn eq_join_right( args: EqJoinArgs<'_, K, S>, ) -> impl Stream<Item = Result<StreamChunk, StreamExecutorError>> + '_

Used to forward eq_join_oneside to show join side in stack.

source

fn eq_join_oneside<'_async0, const SIDE: u8>( args: EqJoinArgs<'_async0, K, S>, ) -> impl Stream<Item = Result<StreamChunk, StreamExecutorError>> + '_async0

source

fn handle_match_rows<'a, const SIDE: u8, const JOIN_OP: bool>( cached_lookup_result: CacheResult, row: RowRef<'a>, key: &'a K, hashjoin_chunk_builder: &'a mut JoinChunkBuilder<T, SIDE>, side_match: &'a mut JoinSide<K, S>, side_update: &'a mut JoinSide<K, S>, useful_state_clean_columns: &'a [(usize, &'a Watermark)], cond: &'a mut Option<NonStrictExpression>, append_only_optimize: bool, entry_state_max_rows: usize, ) -> impl Stream<Item = Result<StreamChunk, StreamExecutorError>> + 'a

For the probe-side row, we need to check if it has values in cache, if not, we need to fetch the matched rows from the state table.

Every matched build-side row being processed needs to go through the following phases:

  1. Handle join condition evaluation.
  2. Always do cache refill, if the state count is good.
  3. Handle state cleaning.
  4. Handle degree table update.
source

async fn handle_match_row<'a, const SIDE: u8, const JOIN_OP: bool, const MATCHED_ROWS_FROM_CACHE: bool>( update_row: RowRef<'a>, matched_row: JoinRow<OwnedRow>, matched_row_cache_ref: Option<&mut EncodedJoinRow>, hashjoin_chunk_builder: &'a mut JoinChunkBuilder<T, SIDE>, match_order_key_indices: &[usize], match_degree_table: &mut Option<TableInner<S>>, side_update_start_pos: usize, side_match_start_pos: usize, cond: &Option<NonStrictExpression>, update_row_degree: &mut u64, useful_state_clean_columns: &[(usize, &'a Watermark)], append_only_optimize: bool, append_only_matched_row: &mut Option<JoinRow<OwnedRow>>, matched_rows_to_clean: &mut Vec<JoinRow<OwnedRow>>, ) -> Option<StreamChunk>

source

async fn check_join_condition( row: impl Row, side_update_start_pos: usize, matched_row: impl Row, side_match_start_pos: usize, join_condition: &Option<NonStrictExpression>, ) -> bool

Trait Implementations§

source§

impl<K: HashKey, S: StateStore, const T: u8> Debug for HashJoinExecutor<K, S, T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<K: HashKey, S: StateStore, const T: u8> Execute for HashJoinExecutor<K, S, T>

source§

fn execute(self: Box<Self>) -> BoxedMessageStream

source§

fn execute_with_epoch(self: Box<Self>, _epoch: u64) -> BoxedMessageStream

source§

fn boxed(self) -> Box<dyn Execute>
where Self: Sized + Send + 'static,

Auto Trait Implementations§

§

impl<K, S, const T: u8> !Freeze for HashJoinExecutor<K, S, T>

§

impl<K, S, const T: u8> !RefUnwindSafe for HashJoinExecutor<K, S, T>

§

impl<K, S, const T: u8> Send for HashJoinExecutor<K, S, T>

§

impl<K, S, const T: u8> !Sync for HashJoinExecutor<K, S, T>

§

impl<K, S, const T: u8> Unpin for HashJoinExecutor<K, S, T>
where <K as HashKey>::Bitmap: Unpin, <S as StateStore>::Local: Unpin, S: Unpin,

§

impl<K, S, const T: u8> !UnwindSafe for HashJoinExecutor<K, S, T>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<Choices> CoproductSubsetter<CNil, HNil> for Choices

§

type Remainder = Choices

§

fn subset( self, ) -> Result<CNil, <Choices as CoproductSubsetter<CNil, HNil>>::Remainder>

Extract a subset of the possible types in a coproduct (or get the remaining possibilities) Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSend for T
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> IntoResult<T> for T

§

type Err = Infallible

§

fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>

§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
§

impl<T, U, I> LiftInto<U, I> for T
where U: LiftFrom<T, I>,

§

fn lift_into(self) -> U

Performs the indexed conversion.
source§

impl<M> MetricVecRelabelExt for M

source§

fn relabel( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>

source§

fn relabel_n( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, relabel_num: usize, ) -> RelabeledMetricVec<M>

source§

fn relabel_debug_1( self, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>

Equivalent to RelabeledMetricVec::with_metric_level_relabel_n with metric_level set to MetricLevel::Debug and relabel_num set to 1.
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
§

impl<T> Scope for T

§

fn with<F, R>(self, f: F) -> R
where Self: Sized, F: FnOnce(Self) -> R,

Scoped with ownership.
§

fn with_ref<F, R>(&self, f: F) -> R
where F: FnOnce(&Self) -> R,

Scoped with reference.
§

fn with_mut<F, R>(&mut self, f: F) -> R
where F: FnOnce(&mut Self) -> R,

Scoped with mutable reference.
§

impl<Source> Sculptor<HNil, HNil> for Source

§

type Remainder = Source

§

fn sculpt(self) -> (HNil, <Source as Sculptor<HNil, HNil>>::Remainder)

Consumes the current HList and returns an HList with the requested shape. Read more
source§

impl<T> SerTo<T> for T

§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,