Struct taos_query::common::raw::RawBlock

source ·
pub struct RawBlock { /* private fields */ }
Expand description

Raw data block format (B for bytes):

+-----+----------+---------------+-----------+-----------------------+-----------------+
| header | col_schema... | length... | (bitmap or offsets    | col data)   ... |
| 28 B   | (1+4)B * cols | 4B * cols | (row+7)/8 or 4 * rows | length[col] ... |
+-----+----------+---------------+-----------+-----------------------+-----------------+

The length of bitmap is decided by number of rows of this data block, and the length of each column data is recorded in the first segment, next to the struct header

Implementations§

source§

impl RawBlock

source

pub fn from_views(views: &[ColumnView], precision: Precision) -> Self

source

pub unsafe fn parse_from_ptr(ptr: *mut c_void, precision: Precision) -> Self

§Safety

When using this with correct TDengine 3.x raw block pointer, it’s safe.

source

pub unsafe fn parse_from_ptr_v2( ptr: *const *const c_void, fields: &[Field], lengths: &[u32], rows: usize, precision: Precision ) -> Self

§Safety

When using this with correct TDengine 2.x block pointer, it’s safe.

source

pub fn parse_from_raw_block_v2( bytes: impl Into<Bytes>, fields: &[Field], lengths: &[u32], rows: usize, precision: Precision ) -> Self

source

pub fn parse_from_raw_block( bytes: impl Into<Bytes>, precision: Precision ) -> Self

source

pub fn with_database_name(&mut self, name: impl Into<String>) -> &mut Self

Set table name of the block

source

pub fn with_table_name(&mut self, name: impl Into<String>) -> &mut Self

Set table name of the block

source

pub fn with_field_names<S: Display, I: IntoIterator<Item = S>>( &mut self, names: I ) -> &mut Self

Set field names of the block

source

pub fn ncols(&self) -> usize

Number of columns

source

pub fn nrows(&self) -> usize

Number of rows

source

pub const fn precision(&self) -> Precision

Precision for current block.

source

pub const fn group_id(&self) -> u64

source

pub fn table_name(&self) -> Option<&str>

source

pub fn tmq_db_name(&self) -> Option<&str>

source

pub fn schemas(&self) -> &[ColSchema]

source

pub fn field_names(&self) -> &[String]

Get field names.

source

pub fn columns(&self) -> Iter<'_, ColumnView>

Data view in columns.

source

pub fn column_views(&self) -> &[ColumnView]

source

pub fn rows<'a>(&self) -> RowsIter<'a>

Data view in rows.

source

pub fn into_rows<'a>(self) -> IntoRowsIter<'a>
where Self: 'a,

source

pub fn deserialize<'de, 'a: 'de, T>( &'a self ) -> Map<RowsIter<'_>, fn(_: RowView<'a>) -> Result<T, Error>>
where T: Deserialize<'de>,

source

pub fn as_raw_bytes(&self) -> &[u8]

source

pub fn is_null(&self, row: usize, col: usize) -> bool

source

pub unsafe fn get_raw_value_unchecked( &self, row: usize, col: usize ) -> (Ty, u32, *const c_void)

Get one value at (row, col) of the block.

§Safety

(row, col) should not exceed the block limit.

source

pub fn get_ref(&self, row: usize, col: usize) -> Option<BorrowedValue<'_>>

source

pub unsafe fn get_ref_unchecked( &self, row: usize, col: usize ) -> BorrowedValue<'_>

Get one value at (row, col) of the block.

§Safety

Ensure that row and col not exceed the limit of the block.

source

pub fn to_values(&self) -> Vec<Vec<Value>>

source

pub fn write<W: Write>(&self, _wtr: W) -> Result<usize>

source

pub fn fields(&self) -> Vec<Field>

source

pub fn pretty_format(&self) -> PrettyBlock<'_>

source

pub fn to_create(&self) -> Option<MetaCreate>

source

pub fn concat(&self, rhs: &Self) -> Self

Concatenate two blocks into one by rows.

§Panics

If the two blocks have different schemas.

source

pub fn cast_precision(&self, precision: Precision) -> Self

Cast the block into a new block with new precision.

Trait Implementations§

source§

impl Add for &RawBlock

§

type Output = RawBlock

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
source§

impl Add for RawBlock

§

type Output = RawBlock

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
source§

impl AsyncInlinable for RawBlock

source§

fn read_optional_inlined<'life0, 'async_trait, R>( reader: &'life0 mut R ) -> Pin<Box<dyn Future<Output = Result<Option<Self>>> + Send + 'async_trait>>
where R: 'async_trait + AsyncRead + Send + Unpin, Self: 'async_trait, 'life0: 'async_trait,

source§

fn read_inlined<'life0, 'async_trait, R>( reader: &'life0 mut R ) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
where R: 'async_trait + AsyncRead + Send + Unpin, Self: 'async_trait, 'life0: 'async_trait,

Read inlined bytes into object.
source§

fn write_inlined<'life0, 'life1, 'async_trait, W>( &'life0 self, wtr: &'life1 mut W ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where W: 'async_trait + AsyncWrite + Send + Unpin, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Write inlined bytes to a writer.
source§

fn write_inlined_with<'life0, 'life1, 'async_trait, W>( &'life0 self, wtr: &'life1 mut W, _opts: InlineOpts ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where W: 'async_trait + AsyncWrite + Send + Unpin, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Write inlined bytes with specific options
source§

fn inlined<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Vec<u8>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get inlined bytes as vector.
source§

fn printable_inlined<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get inlined bytes as printable string, all the bytes will displayed with escaped ascii code.
source§

impl Debug for RawBlock

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Inlinable for RawBlock

source§

fn read_inlined<R: Read>(reader: &mut R) -> Result<Self>

Read inlined bytes into object.
source§

fn read_optional_inlined<R: Read>(reader: &mut R) -> Result<Option<Self>>

source§

fn write_inlined<W: Write>(&self, wtr: &mut W) -> Result<usize>

Write inlined bytes to a writer.
source§

fn write_inlined_with<W: Write>( &self, wtr: &mut W, _opts: InlineOpts ) -> Result<usize>

Write inlined bytes with specific options
source§

fn inlined(&self) -> Vec<u8>

Get inlined bytes as vector.
source§

fn printable_inlined(&self) -> String

Get inlined bytes as printable string, all the bytes will displayed with escaped ascii code.
source§

impl Send for RawBlock

source§

impl Sync for RawBlock

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

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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.