Skip to main content

DataType

Enum DataType 

Source
pub enum DataType {
Show 19 variants Null, Boolean, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Float32, Float64, Utf8, Binary, Date32, Time64, Timestamp(TimeUnit, Option<String>), Interval, Decimal128 { precision: u8, scale: u8, },
}
Expand description

An Arrow type.

The subset our own types map onto, which is every type the engine can produce a value of today. The nested types are missing for the same reason rudb-vector has no nested vector: a list is offsets plus a child array, and there is no child array until the storage layer has one.

Variants§

§

Null

No values, all null, no buffers at all.

§

Boolean

One bit per value.

§

Int8

8 bit signed.

§

Int16

16 bit signed.

§

Int32

32 bit signed.

§

Int64

64 bit signed.

§

UInt8

8 bit unsigned.

§

UInt16

16 bit unsigned.

§

UInt32

32 bit unsigned.

§

UInt64

64 bit unsigned.

§

Float32

IEEE 754 binary32.

§

Float64

IEEE 754 binary64.

§

Utf8

UTF-8, with 32 bit offsets.

§

Binary

Bytes, with 32 bit offsets.

§

Date32

Days since 1970-01-01, 32 bit.

§

Time64

Microseconds since midnight, 64 bit.

§

Timestamp(TimeUnit, Option<String>)

Microseconds since the epoch, 64 bit, with a time zone when there is one.

§

Interval

Months, days and nanoseconds, sixteen bytes.

§

Decimal128

A 128 bit integer with a decimal point in it.

Fields

§precision: u8

How many digits it can hold.

§scale: u8

How many of them are after the point.

Implementations§

Source§

impl DataType

Source

pub fn of(ty: &LogicalType) -> Result<Self>

The Arrow type one of ours becomes.

HUGEINT becomes DECIMAL128(38, 0), which is what DuckDB exports it as and the only thing it can be: Arrow has no 128 bit integer and a decimal with no fractional digits is one.

§Errors

For a type with no Arrow counterpart yet, which is the nested types, UHUGEINT, BIT and UUID.

Source

pub fn format(&self) -> String

The format string the Arrow C data interface names this type with.

Written now, before there is an FFI boundary to hand it across, because it is the part of the mapping that is defined by somebody else’s document and the part a test can check against that document. The export itself is then a struct with this string in it.

Source

pub fn buffer_count(&self) -> usize

How many buffers an array of this type has, which the C data interface also has to say.

Two for anything fixed width, which is the validity bitmap and the values. Three for a variable width type, which puts the offsets in between. None at all for the null type, which has no values to be valid or invalid.

Source

pub fn width(&self) -> Option<usize>

How wide one value is, for the fixed width types.

Trait Implementations§

Source§

impl Clone for DataType

Source§

fn clone(&self) -> DataType

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for DataType

Source§

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

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

impl Eq for DataType

Source§

impl PartialEq for DataType

Source§

fn eq(&self, other: &DataType) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DataType

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.