Skip to main content

HashJoinOperator

Struct HashJoinOperator 

Source
pub struct HashJoinOperator { /* private fields */ }
Expand description

Streaming hash join operator.

The join proceeds in two phases:

  1. Build Phase (in open()):

    • Materialize the build side (smaller side)
    • Build hash table on join keys
  2. Probe Phase (in next()):

    • Stream through probe side one row at a time
    • Lookup matches in hash table
    • Return combined rows

For OUTER joins, additional tracking is used to ensure unmatched rows are returned with NULL padding.

Implementations§

Source§

impl HashJoinOperator

Source

pub fn new( left: Box<dyn Operator>, right: Box<dyn Operator>, join_type: JoinType, left_key_indices: Vec<usize>, right_key_indices: Vec<usize>, build_side: JoinSide, ) -> Self

Create a new hash join operator.

§Arguments
  • left - Left input operator
  • right - Right input operator
  • join_type - Type of join (INNER, LEFT, RIGHT, FULL)
  • left_key_indices - Column indices for left join keys
  • right_key_indices - Column indices for right join keys
  • build_side - Which side to use as build (typically smaller)
Source

pub fn with_prebuilt( probe: Box<dyn Operator>, hash_state: JoinHashState, join_type: JoinType, left_key_indices: Vec<usize>, right_key_indices: Vec<usize>, build_is_left: bool, build_col_count: usize, ) -> Result<Self>

Create a hash join operator with pre-built hash table and rows.

This avoids the build phase in open() since the hash table is already constructed. Used by streaming joins where hash table and bloom filter are built together in a single pass for efficiency.

§Arguments
  • probe - Probe side operator (will be iterated during join)
  • hash_state - Exact build rows, key layout and their pre-built table
  • join_type - Type of join
  • left_key_indices - Key indices for the logical left side
  • right_key_indices - Key indices for the logical right side
  • build_is_left - Whether build side is left (for schema ordering)
Source

pub fn self_join( input: Box<dyn Operator>, join_type: JoinType, left_key_indices: Vec<usize>, right_key_indices: Vec<usize>, ) -> Self

Create an optimized self-join operator.

For self-joins (t1 JOIN t1), this avoids scanning the table twice by reusing the same materialized data for both build and probe.

Source

pub fn with_projection( self, columns: Vec<ColumnSource>, projected_schema: Vec<ColumnInfo>, ) -> Self

Set projection pushdown configuration.

When set, the operator creates projected rows directly from the left/right sources instead of materializing a full combined join row and projecting it later. ColumnSource::Outer means the logical left side and ColumnSource::Inner means the logical right side.

Source

pub fn with_residual_filters(self, filters: Vec<JoinFilter>) -> Self

Attach the non-equality part of ON to the hash match-state owner. Equality hash hits do not count as matches until every residual accepts the same virtual left/right pair.

Trait Implementations§

Source§

impl Operator for HashJoinOperator

Source§

fn open(&mut self) -> Result<()>

Initialize the operator. Read more
Source§

fn next(&mut self) -> Result<Option<RowRef>>

Get the next row from this operator. Read more
Source§

fn close(&mut self) -> Result<()>

Close the operator and release resources. Read more
Source§

fn schema(&self) -> &[ColumnInfo]

Get the schema (column information) for this operator’s output.
Source§

fn estimated_rows(&self) -> Option<usize>

Get an estimate of the number of rows this operator will produce. Read more
Source§

fn name(&self) -> &str

Get a descriptive name for this operator (for EXPLAIN).
Source§

fn ordering(&self) -> OrderingProperty

Physical ordering guaranteed by this operator’s output. Read more

Auto Trait Implementations§

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
Source§

impl<T> CompactArcDrop for T

Source§

unsafe fn drop_and_dealloc(ptr: *mut u8)

Drop the contained data and deallocate the header+data allocation. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

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
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

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

Source§

fn vzip(self) -> V