Trait grafana_plugin_sdk::data::FieldType
source · pub trait FieldType {
type Array;
const ARROW_DATA_TYPE: DataType;
// Provided method
fn convert_arrow_array(
array: Self::Array,
_data_type: DataType
) -> Self::Array { ... }
}
Expand description
Indicates that a type is can be stored in an Arrow array.
Required Associated Types§
Required Associated Constants§
sourceconst ARROW_DATA_TYPE: DataType
const ARROW_DATA_TYPE: DataType
The logical arrow data type that an arrow array of this data should have.
Provided Methods§
sourcefn convert_arrow_array(array: Self::Array, _data_type: DataType) -> Self::Array
fn convert_arrow_array(array: Self::Array, _data_type: DataType) -> Self::Array
Convert the logical type of Self::Array
, if needed.
The default implementation is a no-op, but some field types may need to implement this to ensure the underlying boxed Arrow array can be downcast correctly.
Object Safety§
This trait is not object safe.
Implementations on Foreign Types§
source§impl FieldType for bool
impl FieldType for bool
type Array = BooleanArray
const ARROW_DATA_TYPE: DataType = DataType::Boolean
fn convert_arrow_array(array: Self::Array, _data_type: DataType) -> Self::Array
source§impl FieldType for f32
impl FieldType for f32
type Array = PrimitiveArray<f32>
const ARROW_DATA_TYPE: DataType = DataType::Float32
fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
source§impl FieldType for f64
impl FieldType for f64
type Array = PrimitiveArray<f64>
const ARROW_DATA_TYPE: DataType = DataType::Float64
fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
source§impl FieldType for i8
impl FieldType for i8
type Array = PrimitiveArray<i8>
const ARROW_DATA_TYPE: DataType = DataType::Int8
fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
source§impl FieldType for i16
impl FieldType for i16
type Array = PrimitiveArray<i16>
const ARROW_DATA_TYPE: DataType = DataType::Int16
fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
source§impl FieldType for i32
impl FieldType for i32
type Array = PrimitiveArray<i32>
const ARROW_DATA_TYPE: DataType = DataType::Int32
fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
source§impl FieldType for i64
impl FieldType for i64
type Array = PrimitiveArray<i64>
const ARROW_DATA_TYPE: DataType = DataType::Int64
fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
source§impl FieldType for u8
impl FieldType for u8
type Array = PrimitiveArray<u8>
const ARROW_DATA_TYPE: DataType = DataType::UInt8
fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
source§impl FieldType for u16
impl FieldType for u16
type Array = PrimitiveArray<u16>
const ARROW_DATA_TYPE: DataType = DataType::UInt16
fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
source§impl FieldType for u32
impl FieldType for u32
type Array = PrimitiveArray<u32>
const ARROW_DATA_TYPE: DataType = DataType::UInt32
fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
source§impl FieldType for u64
impl FieldType for u64
type Array = PrimitiveArray<u64>
const ARROW_DATA_TYPE: DataType = DataType::UInt64
fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
source§impl FieldType for SystemTime
impl FieldType for SystemTime
source§fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
Convert the logical type of Self::Array
to DataType::Timestamp
.
type Array = PrimitiveArray<i64>
const ARROW_DATA_TYPE: DataType = _
source§impl FieldType for NaiveDate
impl FieldType for NaiveDate
source§fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
Convert the logical type of Self::Array
to DataType::Timestamp
.
type Array = PrimitiveArray<i64>
const ARROW_DATA_TYPE: DataType = _
source§impl FieldType for NaiveDateTime
impl FieldType for NaiveDateTime
source§fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
Convert the logical type of Self::Array
to DataType::Timestamp
.
type Array = PrimitiveArray<i64>
const ARROW_DATA_TYPE: DataType = _
source§impl<T> FieldType for Date<T>
impl<T> FieldType for Date<T>
source§fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
Convert the logical type of Self::Array
to DataType::Timestamp
.
type Array = PrimitiveArray<i64>
const ARROW_DATA_TYPE: DataType = _
source§impl<T> FieldType for DateTime<T>
impl<T> FieldType for DateTime<T>
source§fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
fn convert_arrow_array(array: Self::Array, data_type: DataType) -> Self::Array
Convert the logical type of Self::Array
to DataType::Timestamp
.