Enum mz_repr::scalar::Datum

source ·
pub enum Datum<'a> {
Show 28 variants False, True, Int16(i16), Int32(i32), Int64(i64), UInt8(u8), UInt16(u16), UInt32(u32), UInt64(u64), Float32(OrderedFloat<f32>), Float64(OrderedFloat<f64>), Date(Date), Time(NaiveTime), Timestamp(CheckedTimestamp<NaiveDateTime>), TimestampTz(CheckedTimestamp<DateTime<Utc>>), Interval(Interval), Bytes(&'a [u8]), String(&'a str), Array(Array<'a>), List(DatumList<'a>), Map(DatumMap<'a>), Numeric(OrderedDecimal<Numeric>), JsonNull, Uuid(Uuid), MzTimestamp(Timestamp), Range(Range<DatumNested<'a>>), Dummy, Null,
}
Expand description

A single value.

Notes

Equality

Datum must always derive Eq to enforce equality with repr::Row.

Datum-containing types

Because Rust disallows recursive enums, complex types which need to contain other Datums instead store bytes representing that data in other structs, usually prefixed with Datum (e.g. DatumList). These types perform a form of ad-hoc deserialization of their inner bytes to Datums via crate::row::read_datum.

To create a new instance of a Datum-referencing Datum, you need to store the inner Datum’s bytes in a row (so you can in turn borrow those bytes in the outer Datum). The idiom we’ve devised for this is a series of functions on repr::row::RowPacker prefixed with push_.

Variants§

§

False

The false boolean value.

§

True

The true boolean value.

§

Int16(i16)

A 16-bit signed integer.

§

Int32(i32)

A 32-bit signed integer.

§

Int64(i64)

A 64-bit signed integer.

§

UInt8(u8)

An 8-bit unsigned integer.

§

UInt16(u16)

An 16-bit unsigned integer.

§

UInt32(u32)

A 32-bit unsigned integer.

§

UInt64(u64)

A 64-bit unsigned integer.

§

Float32(OrderedFloat<f32>)

A 32-bit floating point number.

§

Float64(OrderedFloat<f64>)

A 64-bit floating point number.

§

Date(Date)

A date.

§

Time(NaiveTime)

A time.

§

Timestamp(CheckedTimestamp<NaiveDateTime>)

A date and time, without a timezone.

§

TimestampTz(CheckedTimestamp<DateTime<Utc>>)

A date and time, with a timezone.

§

Interval(Interval)

A span of time.

§

Bytes(&'a [u8])

A sequence of untyped bytes.

§

String(&'a str)

A sequence of Unicode codepoints encoded as UTF-8.

§

Array(Array<'a>)

Unlike Datum::List, arrays are like tensors and are not permitted to be ragged.

§

List(DatumList<'a>)

A sequence of Datums.

Unlike Datum::Array, lists are permitted to be ragged.

§

Map(DatumMap<'a>)

A mapping from string keys to Datums.

§

Numeric(OrderedDecimal<Numeric>)

An exact decimal number, possibly with a fractional component, with up to 39 digits of precision.

§

JsonNull

An unknown value within a JSON-typed Datum.

This variant is distinct from Datum::Null as a null datum is distinct from a non-null datum that contains the JSON value null.

§

Uuid(Uuid)

A universally unique identifier.

§

MzTimestamp(Timestamp)

§

Range(Range<DatumNested<'a>>)

A range of values, e.g. [-1, 1).

§

Dummy

A placeholder value.

Dummy values are never meant to be observed. Many operations on Datum panic if called on this variant.

Dummies are useful as placeholders in e.g. a Vec<Datum>, where it is known that a certain element of the vector is never observed and therefore needn’t be computed, but where some Datum must still be provided to maintain the shape of the vector. While any valid datum could be used for this purpose, having a dedicated variant makes it obvious when these optimizations have gone awry. If we used e.g. Datum::Null, an unexpected Datum::Null could indicate any number of problems: bad user data, bad function metadata, or a bad optimization.

§

Null

An unknown value.

Implementations§

Reports whether this datum is null (i.e., is Datum::Null).

Unwraps the boolean value within this datum.

Panics

Panics if the datum is not Datum::False or Datum::True.

Unwraps the 16-bit integer value within this datum.

Panics

Panics if the datum is not Datum::Int16.

Unwraps the 32-bit integer value within this datum.

Panics

Panics if the datum is not Datum::Int32.

Unwraps the 64-bit integer value within this datum.

Panics

Panics if the datum is not Datum::Int64.

Unwraps the 8-bit unsigned integer value within this datum.

Panics

Panics if the datum is not Datum::UInt8.

Unwraps the 16-bit unsigned integer value within this datum.

Panics

Panics if the datum is not Datum::UInt16.

Unwraps the 32-bit unsigned integer value within this datum.

Panics

Panics if the datum is not Datum::UInt32.

Unwraps the 64-bit unsigned integer value within this datum.

Panics

Panics if the datum is not Datum::UInt64.

Unwraps the 32-bit floating-point value within this datum.

Panics

Panics if the datum is not Datum::Float32.

Unwraps the 64-bit floating-point value within this datum.

Panics

Panics if the datum is not Datum::Float64.

Unwraps the date value within this datum.

Panics

Panics if the datum is not Datum::Date.

Unwraps the time vaqlue within this datum.

Panics

Panics if the datum is not Datum::Time.

Unwraps the timestamp value within this datum.

Panics

Panics if the datum is not Datum::Timestamp.

Unwraps the timestamptz value within this datum.

Panics

Panics if the datum is not Datum::TimestampTz.

Unwraps the interval value within this datum.

Panics

Panics if the datum is not Datum::Interval.

Unwraps the string value within this datum.

Panics

Panics if the datum is not Datum::String.

Unwraps the bytes value within this datum.

Panics

Panics if the datum is not Datum::Bytes.

Unwraps the uuid value within this datum.

Panics

Panics if the datum is not Datum::Uuid.

Unwraps the array value within this datum.

Panics

Panics if the datum is not Datum::Array.

Unwraps the list value within this datum.

Panics

Panics if the datum is not Datum::List.

Unwraps the map value within this datum.

Panics

Panics if the datum is not Datum::Map.

Unwraps the numeric value within this datum.

Panics

Panics if the datum is not Datum::Numeric.

Unwraps the mz_repr::Timestamp value within this datum.

Panics

Panics if the datum is not Datum::MzTimestamp.

Unwraps the range value within this datum.

Note that the return type is a range generic over Datum, which is convenient to work with. However, the type stored in the datum is generic over DatumNested, which is necessary to avoid needless boxing of the inner Datum.

Panics

Panics if the datum is not Datum::Range.

Reports whether this datum is an instance of the specified column type.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Whether this Rust type can represent NULL values
Try to convert a Result whose Ok variant is a Datum into this native Rust type (Self). If it fails the error variant will contain the original result.
Convert this Rust type into a Result containing a Datum, or an error
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
The type returned in the event of a conversion error.
Performs the conversion.

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
Formats an object with the “alternative” format ({:#}) and returns it.
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Converts to this type from a reference to the input type.
Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Attaches the current Context to this type, returning a WithContext wrapper. Read more
The type of the output value.
A well-distributed integer derived from the data.
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Wrap the input message T in a tonic::Request
Upcasts this ProgressEventTimestamp to Any. Read more
Returns the name of the concrete type of this object. Read more
Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
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.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more