risingwave_common::hash

Trait HashKeyDispatcher

source
pub trait HashKeyDispatcher: Sized {
    type Output;

    // Required methods
    fn dispatch_impl<K: HashKey>(self) -> Self::Output;
    fn data_types(&self) -> &[DataType];

    // Provided methods
    fn dispatch(self) -> Self::Output { ... }
    fn dispatch_by_key_size<T: NullBitmap>(self) -> Self::Output { ... }
}
Expand description

A trait to help to dynamically dispatch HashKey template.

Suppose you want to build a trait object of type T, whose underlying implementation is S<K: HashKey>, you can implement a HashKeyDispatcher with Output=T. Then you can use dispatch_by_kind to build T directly without working with generic argument K.

Required Associated Types§

Required Methods§

source

fn dispatch_impl<K: HashKey>(self) -> Self::Output

source

fn data_types(&self) -> &[DataType]

The data types used to build the hash key.

Provided Methods§

source

fn dispatch(self) -> Self::Output

Based on the number of group keys and total size of group keys, we decide:

  1. What bitmap to use for representing null values in group keys.
  2. What key type to store group keys in.
source

fn dispatch_by_key_size<T: NullBitmap>(self) -> Self::Output

All data types will be stored in a single HashKey. We use Key<N> for fixed size keys, KeySerialized for variable length keys.

Object Safety§

This trait is not object safe.

Implementors§