Skip to main content

ColumnType

Enum ColumnType 

Source
pub enum ColumnType {
Show 26 variants Int8, Int16, Int32, Int64, Uint8, Uint16, Uint32, Uint64, Float, Double, Boolean, String, Utf8, Any, Date, Datetime, Timestamp, Interval, Date32, Datetime64, Timestamp64, Interval64, Json, Uuid, Void, Null,
}
Expand description

A column’s type, in the type spelling.

The primitives a job’s row can hold. Composite types — lists, structs, tuples — are out of scope here; a column holding one is described as ColumnType::Any, which is what YTsaurus stores an arbitrary YSON value as.

These are the type names. YTsaurus has a second, newer spelling, type_v3, and exactly two names differ between them: boolean is bool there, and any is yson. Sending a type_v3 name in a type field is refused — Error parsing ESimpleLogicalValueType value "bool" — so the two vocabularies must not be mixed. Every other name is the same string in both.

Variants§

§

Int8

8-bit signed integer.

§

Int16

16-bit signed integer.

§

Int32

32-bit signed integer.

§

Int64

64-bit signed integer.

§

Uint8

8-bit unsigned integer.

§

Uint16

16-bit unsigned integer.

§

Uint32

32-bit unsigned integer.

§

Uint64

64-bit unsigned integer.

§

Float

Single-precision float.

§

Double

Double-precision float.

§

Boolean

Boolean.

§

String

A byte string. YTsaurus strings are arbitrary bytes, not text.

§

Utf8

A string the cluster checks is valid UTF-8.

§

Any

Any YSON value, stored as-is.

Never required: the cluster answers Column of type "any" cannot be "required".

§

Date

Days since the Unix epoch, unsigned.

§

Datetime

Seconds since the Unix epoch, unsigned.

§

Timestamp

Microseconds since the Unix epoch, unsigned.

§

Interval

A signed count of microseconds.

§

Date32

Signed days since the Unix epoch.

§

Datetime64

Signed seconds since the Unix epoch.

§

Timestamp64

Signed microseconds since the Unix epoch.

§

Interval64

A signed count of microseconds, over the wider range.

§

Json

UTF-8 text the cluster checks is valid JSON.

§

Uuid

A 16-byte UUID.

§

Void

A column that holds nothing.

Reads back as required=%false without an optional wrapper, unlike every other type.

§

Null

The type with no values at all.

Implementations§

Source§

impl ColumnType

Source

pub fn as_str(self) -> &'static str

The wire name.

Source

pub fn can_be_required(self) -> bool

Whether a column of this type may be declared required.

Three types may not, and the cluster says so in as many words — Column of type "any" cannot be "required", Null type cannot be required, and the same for void. Each of them already means “there may be nothing here”, so promising a value would contradict the type.

Source

pub fn parse(name: &str) -> Option<Self>

Parses a wire name, for the derive’s #[yt(column_type = "…")] escape hatch and for anyone building a schema from configuration.

Accepts either vocabulary — bool and yson are understood as the type_v3 spellings of boolean and any — but what comes back is always the type spelling, which is the one this crate sends.

Not FromStr: an unknown type name is not an error worth a type of its own, and every caller here wants the Option.

Trait Implementations§

Source§

impl Clone for ColumnType

Source§

fn clone(&self) -> ColumnType

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 Copy for ColumnType

Source§

impl Debug for ColumnType

Source§

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

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

impl Eq for ColumnType

Source§

impl PartialEq for ColumnType

Source§

fn eq(&self, other: &ColumnType) -> 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 ColumnType

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = 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>,

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

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more