pub trait VectorOp {
// Required methods
fn replicate(&self, offsets: &[usize]) -> VectorRef;
fn find_unique(
&self,
selected: &mut BitVec,
prev_vector: Option<&dyn Vector>,
);
fn filter(&self, filter: &BooleanVector) -> Result<VectorRef>;
fn cast(&self, to_type: &ConcreteDataType) -> Result<VectorRef>;
fn take(&self, indices: &UInt32Vector) -> Result<VectorRef>;
}
Expand description
Vector compute operations.
Required Methods§
Sourcefn replicate(&self, offsets: &[usize]) -> VectorRef
fn replicate(&self, offsets: &[usize]) -> VectorRef
Copies each element according offsets
parameter.
i-th
element should be copiedoffsets[i] - offsets[i - 1]
times0-th
element would be copiedoffsets[0]
times
§Panics
Panics if offsets.len() != self.len()
.
Sourcefn find_unique(&self, selected: &mut BitVec, prev_vector: Option<&dyn Vector>)
fn find_unique(&self, selected: &mut BitVec, prev_vector: Option<&dyn Vector>)
Mark i-th
bit of selected
to true
if the i-th
element of self
is unique, which
means there is no elements behind it have same value as it.
The caller should ensure
- the length of
selected
bitmap is equal tovector.len()
. vector
andprev_vector
are sorted.
If there are multiple duplicate elements, this function retains the first element.
The first element is considered as unique if the first element of self
is different
from its previous element, that is the last element of prev_vector
.
§Panics
Panics if
selected.len() < self.len()
.prev_vector
andself
have different data types.
Sourcefn filter(&self, filter: &BooleanVector) -> Result<VectorRef>
fn filter(&self, filter: &BooleanVector) -> Result<VectorRef>
Filters the vector, returns elements matching the filter
(i.e. where the values are true).
Note that the nulls of filter
are interpreted as false
will lead to these elements being masked out.
Sourcefn cast(&self, to_type: &ConcreteDataType) -> Result<VectorRef>
fn cast(&self, to_type: &ConcreteDataType) -> Result<VectorRef>
Cast vector to the provided data type and return a new vector with type to_type, if possible.
TODO(dennis) describe behaviors in details.