Struct datagen::relation::UniformRelation
source · [−]pub struct UniformRelation;
Expand description
Generator for relations with uniform distribution.
Implementations
sourceimpl UniformRelation
impl UniformRelation
sourcepub fn gen_primary_key<T: KeyAttribute>(
attr: &mut [T],
selectivity: Option<u32>
) -> Result<()>
pub fn gen_primary_key<T: KeyAttribute>(
attr: &mut [T],
selectivity: Option<u32>
) -> Result<()>
Generates a primary key attribute.
The generated keys are unique and contiguous. The key range starts from 0 and ends before, i.e. excluding, attr.len(). Keys are placed at random locations within the slice.
selectivity
specifies the join selectivity in percent. An according
percentage of keys are set to the NULL
value. By default (None
), the
selectivity is 100%.
sourcepub fn gen_primary_key_par<T: Clone + Send + KeyAttribute>(
attr: &mut [T],
selectivity: Option<u32>
) -> Result<()>
pub fn gen_primary_key_par<T: Clone + Send + KeyAttribute>(
attr: &mut [T],
selectivity: Option<u32>
) -> Result<()>
Generates a primary key attribute in parallel.
The generated keys are unique and contiguous. The key range starts from 0 and ends before, i.e. excluding, attr.len(). Keys are placed at random locations within the slice.
selectivity
specifies the join selectivity in percent. An according
percentage of keys are set to the NULL
value. By default (None
), the
selectivity is 100%.
sourcepub fn gen_foreign_key_from_primary_key<T: Copy>(
fk_attr: &mut [T],
pk_attr: &[T]
)
pub fn gen_foreign_key_from_primary_key<T: Copy>(
fk_attr: &mut [T],
pk_attr: &[T]
)
Generates a foreign key attribute based on a primary key attribute.
The generated keys are sampled from the primary key attribute, that is, they follow a foreign-key relationship. If the primary keys are unique, then the generated foreign keys follow a uniform distribution.
sourcepub fn gen_attr<T: FromPrimitive>(
attr: &mut [T],
range: Range<usize>
) -> Result<()>
pub fn gen_attr<T: FromPrimitive>(
attr: &mut [T],
range: Range<usize>
) -> Result<()>
Generates a uniformly distributed attribute.
The generated values are sampled from range
.
sourcepub fn gen_attr_par<T: FromPrimitive + Send>(
attr: &mut [T],
range: Range<usize>
) -> Result<()>
pub fn gen_attr_par<T: FromPrimitive + Send>(
attr: &mut [T],
range: Range<usize>
) -> Result<()>
Generates a uniformly distributed attribute in parallel.
The generated values are sampled from range
.
Auto Trait Implementations
impl RefUnwindSafe for UniformRelation
impl Send for UniformRelation
impl Sync for UniformRelation
impl Unpin for UniformRelation
impl UnwindSafe for UniformRelation
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more