pub trait StreamChunkTestExt {
// Required methods
fn from_pretty(_: &str) -> Self;
fn valid(&self) -> bool;
fn concat(_: Vec<StreamChunk>) -> StreamChunk;
fn sort_rows(self) -> Self;
fn gen_stream_chunks(
_: usize,
_: usize,
_: &[DataType],
_: &VarcharProperty,
) -> Vec<StreamChunk>;
fn gen_stream_chunks_inner(
_: usize,
_: usize,
_: &[DataType],
_: &VarcharProperty,
_: f64,
_: f64,
) -> Vec<StreamChunk>;
}
Expand description
Test utilities for StreamChunk
.
Required Methods§
sourcefn from_pretty(_: &str) -> Self
fn from_pretty(_: &str) -> Self
Parse a chunk from string.
See also DataChunkTestExt::from_pretty
.
§Format
The first line is a header indicating the column types.
The following lines indicate rows within the chunk.
Each line starts with an operation followed by values.
NULL values are represented as .
.
§Example
use risingwave_common::array::stream_chunk::StreamChunkTestExt as _;
use risingwave_common::array::StreamChunk;
let chunk = StreamChunk::from_pretty(
" I I I I // type chars
U- 2 5 . . // '.' means NULL
U+ 2 5 2 6 D // 'D' means deleted in visibility
+ . . 4 8 // ^ comments are ignored
- . . 3 4",
);
// ^ operations:
// +: Insert
// -: Delete
// U+: UpdateInsert
// U-: UpdateDelete
// type chars:
// I: i64
// i: i32
// F: f64
// f: f32
// T: str
// TS: Timestamp
// TZ: Timestamptz
// SRL: Serial
// x[]: array of x
// <i,f>: struct
sourcefn concat(_: Vec<StreamChunk>) -> StreamChunk
fn concat(_: Vec<StreamChunk>) -> StreamChunk
Concatenate multiple StreamChunk
into one.
Panics if chunks
is empty.
sourcefn gen_stream_chunks(
_: usize,
_: usize,
_: &[DataType],
_: &VarcharProperty,
) -> Vec<StreamChunk>
fn gen_stream_chunks( _: usize, _: usize, _: &[DataType], _: &VarcharProperty, ) -> Vec<StreamChunk>
Generate num_of_chunks
data chunks with type data_types
,
where each data chunk has cardinality of chunk_size
.
TODO(kwannoel): Generate different types of op, different vis.
fn gen_stream_chunks_inner( _: usize, _: usize, _: &[DataType], _: &VarcharProperty, _: f64, _: f64, ) -> Vec<StreamChunk>
Object Safety§
This trait is not object safe.