Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
RowType in datafusion_row::layout - Rust
[go: Go Back, main page]

pub enum RowType {
    Compact,
    WordAligned,
}
Expand description

Type of a RowLayout

Variants§

§

Compact

Stores each field with minimum bytes for space efficiency.

Its typical use case represents a sorting payload that accesses all row fields as a unit.

Each tuple consists of up to three parts: “null bit set” , “values” and “var length data

The null bit set is used for null tracking and is aligned to 1-byte. It stores one bit per field.

In the region of the values, we store the fields in the order they are defined in the schema.

  • For fixed-length, sequential access fields, we store them directly. E.g., 4 bytes for int and 1 byte for bool.
  • For fixed-length, update often fields, we store one 8-byte word per field.
  • For fields of non-primitive or variable-length types, we append their actual content to the end of the var length region and store their offset relative to row base and their length, packed into an 8-byte word.
┌────────────────┬──────────────────────────┬───────────────────────┐        ┌───────────────────────┬────────────┐
│Validity Bitmask│    Fixed Width Field     │ Variable Width Field  │   ...  │     vardata area      │  padding   │
│ (byte aligned) │   (native type width)    │(vardata offset + len) │        │   (variable length)   │   bytes    │
└────────────────┴──────────────────────────┴───────────────────────┘        └───────────────────────┴────────────┘

For example, given the schema (Int8, Utf8, Float32, Utf8)

Encoding the tuple (1, “FooBar”, NULL, “baz”)

Requires 32 bytes (31 bytes payload and 1 byte padding to make each tuple 8-bytes aligned):

┌──────────┬──────────┬──────────────────────┬──────────────┬──────────────────────┬───────────────────────┬──────────┐
│0b00001011│   0x01   │0x00000016  0x00000006│  0x00000000  │0x0000001C  0x00000003│       FooBarbaz       │   0x00   │
└──────────┴──────────┴──────────────────────┴──────────────┴──────────────────────┴───────────────────────┴──────────┘
0          1          2                     10              14                     22                     31         32
§

WordAligned

This type of layout stores one 8-byte word per field for CPU-friendly, It is mainly used to represent the rows with frequently updated content, for example, grouping state for hash aggregation.

Trait Implementations§

source§

impl Clone for RowType

source§

fn clone(&self) -> RowType

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for RowType

source§

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

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

impl Copy for RowType

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Allocation for Twhere T: RefUnwindSafe + Send + Sync,