Enum arrow2::datatypes::DataType[][src]

pub enum DataType {
Show 34 variants Null, Boolean, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Float16, Float32, Float64, Timestamp(TimeUnitOption<String>), Date32, Date64, Time32(TimeUnit), Time64(TimeUnit), Duration(TimeUnit), Interval(IntervalUnit), Binary, FixedSizeBinary(i32), LargeBinary, Utf8, LargeUtf8, List(Box<Field>), FixedSizeList(Box<Field>, i32), LargeList(Box<Field>), Struct(Vec<Field>), Union(Vec<Field>, Option<Vec<i32>>, bool), Map(Box<Field>, bool), Dictionary(Box<DataType>, Box<DataType>), Decimal(usizeusize), Extension(StringBox<DataType>, Option<String>),
}
Expand description

The set of supported logical types. Each variant uniquely identifies a logical type, which define specific semantics to the data (e.g. how it should be represented). Each variant has a corresponding PhysicalType, obtained via DataType::to_physical_type, which declares the in-memory representation of data. The DataType::Extension is special in that it augments a DataType with metadata to support custom types. Use to_logical_type to desugar such type and return its correspoding logical type.

Variants

Null

Null type

Boolean

true and false.

Int8

A signed 8-bit integer.

Int16

A signed 16-bit integer.

Int32

A signed 32-bit integer.

Int64

A signed 64-bit integer.

UInt8

An unsigned 8-bit integer.

UInt16

An unsigned 16-bit integer.

UInt32

An unsigned 32-bit integer.

UInt64

An unsigned 64-bit integer.

Float16

A 16-bit floating point number.

Float32

A 32-bit floating point number.

Float64

A 64-bit floating point number.

Timestamp(TimeUnitOption<String>)

A timestamp with an optional timezone.

Time is measured as a Unix epoch, counting the seconds from 00:00:00.000 on 1 January 1970, excluding leap seconds, as a 64-bit integer.

The time zone is a string indicating the name of a time zone, one of:

  • As used in the Olson time zone database (the “tz database” or “tzdata”), such as “America/New_York”
  • An absolute time zone offset of the form +XX:XX or -XX:XX, such as +07:30

Tuple Fields of Timestamp

0: TimeUnit1: Option<String>
Date32

A 32-bit date representing the elapsed time since UNIX epoch (1970-01-01) in days (32 bits).

Date64

A 64-bit date representing the elapsed time since UNIX epoch (1970-01-01) in milliseconds (64 bits). Values are evenly divisible by 86400000.

Time32(TimeUnit)

A 32-bit time representing the elapsed time since midnight in the unit of TimeUnit.

Tuple Fields of Time32

0: TimeUnit
Time64(TimeUnit)

A 64-bit time representing the elapsed time since midnight in the unit of TimeUnit.

Tuple Fields of Time64

0: TimeUnit
Duration(TimeUnit)

Measure of elapsed time in either seconds, milliseconds, microseconds or nanoseconds.

Tuple Fields of Duration

0: TimeUnit
Interval(IntervalUnit)

A “calendar” interval which models types that don’t necessarily have a precise duration without the context of a base timestamp (e.g. days can differ in length during day light savings time transitions).

Tuple Fields of Interval

0: IntervalUnit
Binary

Opaque binary data of variable length.

FixedSizeBinary(i32)

Opaque binary data of fixed size. Enum parameter specifies the number of bytes per value.

Tuple Fields of FixedSizeBinary

0: i32
LargeBinary

Opaque binary data of variable length and 64-bit offsets.

Utf8

A variable-length string in Unicode with UTF-8 encoding.

LargeUtf8

A variable-length string in Unicode with UFT-8 encoding and 64-bit offsets.

List(Box<Field>)

A list of some logical data type with variable length.

Tuple Fields of List

0: Box<Field>
FixedSizeList(Box<Field>, i32)

A list of some logical data type with fixed length.

Tuple Fields of FixedSizeList

0: Box<Field>1: i32
LargeList(Box<Field>)

A list of some logical data type with variable length and 64-bit offsets.

Tuple Fields of LargeList

0: Box<Field>
Struct(Vec<Field>)

A nested datatype that contains a number of sub-fields.

Tuple Fields of Struct

0: Vec<Field>
Union(Vec<Field>, Option<Vec<i32>>, bool)

A nested datatype that can represent slots of differing types. Third argument represents sparsness

Tuple Fields of Union

0: Vec<Field>1: Option<Vec<i32>>2: bool
Map(Box<Field>, bool)

A nested type that is represented as

List<entries: Struct<key: K, value: V>>

In this layout, the keys and values are each respectively contiguous. We do not constrain the key and value types, so the application is responsible for ensuring that the keys are hashable and unique. Whether the keys are sorted may be set in the metadata for this field.

In a field with Map type, the field has a child Struct field, which then has two children: key type and the second the value type. The names of the child fields may be respectively “entries”, “key”, and “value”, but this is not enforced.

Map

  - child[0] entries: Struct
    - child[0] key: K
    - child[1] value: V

Neither the “entries” field nor the “key” field may be nullable.

The metadata is structured so that Arrow systems without special handling for Map can make Map an alias for List. The “layout” attribute for the Map field must have the same contents as a List.

Tuple Fields of Map

0: Box<Field>1: bool
Dictionary(Box<DataType>, Box<DataType>)

A dictionary encoded array (key_type, value_type), where each array element is an index of key_type into an associated dictionary of value_type.

Dictionary arrays are used to store columns of value_type that contain many repeated values using less memory, but with a higher CPU overhead for some operations.

This type mostly used to represent low cardinality string arrays or a limited set of primitive types as integers.

Tuple Fields of Dictionary

0: Box<DataType>1: Box<DataType>
Decimal(usizeusize)

Decimal value with precision and scale precision is the number of digits in the number and scale is the number of decimal places. The number 999.99 has a precision of 5 and scale of 2.

Tuple Fields of Decimal

0: usize1: usize
Extension(StringBox<DataType>, Option<String>)

Extension type.

Tuple Fields of Extension

0: String1: Box<DataType>2: Option<String>

Implementations

the PhysicalType of this DataType.

Returns &self for all but DataType::Extension. For DataType::Extension, (recursively) returns the inner DataType. Never returns the variant DataType::Extension.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.