pub enum DataType {
Show 20 variants
Boolean,
Int16,
Int32,
Int64,
Float32,
Float64,
Decimal,
Date,
Varchar,
Time,
Timestamp,
Timestamptz,
Interval,
Struct(StructType),
List(Box<DataType>),
Bytea,
Jsonb,
Serial,
Int256,
Map(MapType),
}
Expand description
The set of datatypes that are supported in RisingWave.
§Trait implementations
EnumDiscriminants
generatesDataTypeName
enum with the same variants, but without data fields.FromStr
is only used internally for tests. The generated implementation isn’t efficient, and doesn’t handle whitespaces, etc.
Variants§
Boolean
Int16
Int32
Int64
Float32
Float64
Decimal
Date
Varchar
Time
Timestamp
Timestamptz
Interval
Struct(StructType)
List(Box<DataType>)
Bytea
Jsonb
Serial
Int256
Map(MapType)
Implementations§
source§impl DataType
impl DataType
Get type information compatible with Postgres type, such as oid, type length.
sourcepub fn type_len(&self) -> i16
pub fn type_len(&self) -> i16
For a fixed-size type, typlen is the number of bytes in the internal representation of the type. But for a variable-length type, typlen is negative. -1 indicates a “varlena” type (one that has a length word), -2 indicates a null-terminated C string.
https://www.postgresql.org/docs/15/catalog-pg-type.html#:~:text=of%20the%20type-,typlen,-int2
pub fn from_oid(oid: i32) -> Result<Self, UnsupportedOid>
sourcepub fn to_oid(&self) -> i32
pub fn to_oid(&self) -> i32
Refer to Self::from_oid
pub fn pg_name(&self) -> &'static str
source§impl DataType
impl DataType
pub fn create_array_builder(&self, capacity: usize) -> ArrayBuilderImpl
pub fn prost_type_name(&self) -> PbTypeName
pub fn to_protobuf(&self) -> PbDataType
pub fn is_numeric(&self) -> bool
pub fn is_array(&self) -> bool
pub fn is_struct(&self) -> bool
pub fn is_map(&self) -> bool
pub fn is_int(&self) -> bool
sourcepub fn window_of(input: &DataType) -> Option<DataType>
pub fn window_of(input: &DataType) -> Option<DataType>
Returns the output type of time window function on a given input type.
pub fn new_struct(fields: Vec<DataType>, field_names: Vec<String>) -> Self
pub fn new_unnamed_struct(fields: Vec<DataType>) -> Self
pub fn as_struct(&self) -> &StructType
pub fn as_map(&self) -> &MapType
pub fn into_map(self) -> MapType
sourcepub fn unnest_list(&self) -> &Self
pub fn unnest_list(&self) -> &Self
Return a new type that removes the outer list, and get the innermost element type.
Use DataType::as_list
if you only want the element type of a list.
use risingwave_common::types::DataType::*;
assert_eq!(List(Box::new(Int32)).unnest_list(), &Int32);
assert_eq!(List(Box::new(List(Box::new(Int32)))).unnest_list(), &Int32);
sourcepub fn array_ndims(&self) -> usize
pub fn array_ndims(&self) -> usize
Return the number of dimensions of this array/list type. Return 0
when this type is not an
array/list.
sourcepub fn equals_datatype(&self, other: &DataType) -> bool
pub fn equals_datatype(&self, other: &DataType) -> bool
Compares the datatype with another, ignoring nested field names and metadata.
Trait Implementations§
source§impl From<&DataType> for DataType
impl From<&DataType> for DataType
source§fn from(proto: &PbDataType) -> DataType
fn from(proto: &PbDataType) -> DataType
source§impl<'_enum> From<&'_enum DataType> for DataTypeName
impl<'_enum> From<&'_enum DataType> for DataTypeName
source§fn from(val: &'_enum DataType) -> DataTypeName
fn from(val: &'_enum DataType) -> DataTypeName
source§impl From<DataType> for PbDataType
impl From<DataType> for PbDataType
source§impl From<DataType> for DataTypeName
impl From<DataType> for DataTypeName
source§fn from(val: DataType) -> DataTypeName
fn from(val: DataType) -> DataTypeName
source§impl Ord for DataType
impl Ord for DataType
source§impl PartialOrd for DataType
impl PartialOrd for DataType
source§impl TryFrom<DataTypeName> for DataType
impl TryFrom<DataTypeName> for DataType
impl Eq for DataType
impl StructuralPartialEq for DataType
impl ZeroHeapSize for DataType
Auto Trait Implementations§
impl Freeze for DataType
impl RefUnwindSafe for DataType
impl Send for DataType
impl Sync for DataType
impl Unpin for DataType
impl UnwindSafe for DataType
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
source§impl<T> EstimateSize for Twhere
T: ZeroHeapSize,
impl<T> EstimateSize for Twhere
T: ZeroHeapSize,
source§fn estimated_heap_size(&self) -> usize
fn estimated_heap_size(&self) -> usize
source§fn estimated_size(&self) -> usizewhere
Self: Sized,
fn estimated_size(&self) -> usizewhere
Self: Sized,
estimated_heap_size
and the size of Self
.§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
source§impl<M> MetricVecRelabelExt for M
impl<M> MetricVecRelabelExt for M
source§fn relabel(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level
.source§fn relabel_n(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
relabel_num: usize,
) -> RelabeledMetricVec<M>
fn relabel_n( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, relabel_num: usize, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level_relabel_n
.source§fn relabel_debug_1(
self,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel_debug_1( self, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level_relabel_n
with metric_level
set to
MetricLevel::Debug
and relabel_num
set to 1.