common_query::prelude

Enum ScalarValue

pub enum ScalarValue {
Show 43 variants Null, Boolean(Option<bool>), Float16(Option<f16>), Float32(Option<f32>), Float64(Option<f64>), Decimal128(Option<i128>, u8, i8), Decimal256(Option<i256>, u8, i8), Int8(Option<i8>), Int16(Option<i16>), Int32(Option<i32>), Int64(Option<i64>), UInt8(Option<u8>), UInt16(Option<u16>), UInt32(Option<u32>), UInt64(Option<u64>), Utf8(Option<String>), LargeUtf8(Option<String>), Binary(Option<Vec<u8>>), FixedSizeBinary(i32, Option<Vec<u8>>), LargeBinary(Option<Vec<u8>>), FixedSizeList(Arc<FixedSizeListArray>), List(Arc<GenericListArray<i32>>), LargeList(Arc<GenericListArray<i64>>), Struct(Arc<StructArray>), Date32(Option<i32>), Date64(Option<i64>), Time32Second(Option<i32>), Time32Millisecond(Option<i32>), Time64Microsecond(Option<i64>), Time64Nanosecond(Option<i64>), TimestampSecond(Option<i64>, Option<Arc<str>>), TimestampMillisecond(Option<i64>, Option<Arc<str>>), TimestampMicrosecond(Option<i64>, Option<Arc<str>>), TimestampNanosecond(Option<i64>, Option<Arc<str>>), IntervalYearMonth(Option<i32>), IntervalDayTime(Option<i64>), IntervalMonthDayNano(Option<i128>), DurationSecond(Option<i64>), DurationMillisecond(Option<i64>), DurationMicrosecond(Option<i64>), DurationNanosecond(Option<i64>), Union(Option<(i8, Box<ScalarValue>)>, UnionFields, UnionMode), Dictionary(Box<DataType>, Box<ScalarValue>),
}
Expand description

A dynamically typed, nullable single value.

While an arrow [Array]) stores one or more values of the same type, in a single column, a ScalarValue stores a single value of a single type, the equivalent of 1 row and one column.

 ┌────────┐
 │ value1 │
 │ value2 │                  ┌────────┐
 │ value3 │                  │ value2 │
 │  ...   │                  └────────┘
 │ valueN │
 └────────┘

   Array                     ScalarValue

stores multiple,             stores a single,
possibly null, values of     possible null, value
the same type

§Performance

In general, performance will be better using arrow [Array]s rather than ScalarValue, as it is far more efficient to process multiple values at once (vectorized processing).

§Example

// Create single scalar value for an Int32 value
let s1 = ScalarValue::Int32(Some(10));

// You can also create values using the From impl:
let s2 = ScalarValue::from(10i32);
assert_eq!(s1, s2);

§Null Handling

ScalarValue represents null values in the same way as Arrow. Nulls are “typed” in the sense that a null value in an [Int32Array] is different than a null value in a [Float64Array], and is different than the values in a [NullArray].

// You can create a 'null' Int32 value directly:
let s1 = ScalarValue::Int32(None);

// You can also create a null value for a given datatype:
let s2 = ScalarValue::try_from(&DataType::Int32)?;
assert_eq!(s1, s2);

// Note that this is DIFFERENT than a `ScalarValue::Null`
let s3 = ScalarValue::Null;
assert_ne!(s1, s3);

§Nested Types

List / LargeList / FixedSizeList / Struct are represented as a single element array of the corresponding type.

§Example: Creating ScalarValue::Struct using [ScalarStructBuilder]

// Build a struct like: {a: 1, b: "foo"}
let field_a = Field::new("a", DataType::Int32, false);
let field_b = Field::new("b", DataType::Utf8, false);

let s1 = ScalarStructBuilder::new()
   .with_scalar(field_a, ScalarValue::from(1i32))
   .with_scalar(field_b, ScalarValue::from("foo"))
   .build();

§Example: Creating a null ScalarValue::Struct using [ScalarStructBuilder]

// Build a struct representing a NULL value
let fields = vec![
    Field::new("a", DataType::Int32, false),
    Field::new("b", DataType::Utf8, false),
];

let s1 = ScalarStructBuilder::new_null(fields);

§Example: Creating ScalarValue::Struct directly

// Build a struct like: {a: 1, b: "foo"}
// Field description
let fields = Fields::from(vec![
  Field::new("a", DataType::Int32, false),
  Field::new("b", DataType::Utf8, false),
]);
// one row arrays for each field
let arrays: Vec<ArrayRef> = vec![
  Arc::new(Int32Array::from(vec![1])),
  Arc::new(StringArray::from(vec!["foo"])),
];
// no nulls for this array
let nulls = None;
let arr = StructArray::new(fields, arrays, nulls);

// Create a ScalarValue::Struct directly
let s1 = ScalarValue::Struct(Arc::new(arr));

§Further Reading

See datatypes for details on datatypes and the format for the definitive reference.

Variants§

§

Null

represents DataType::Null (castable to/from any other type)

§

Boolean(Option<bool>)

true or false value

§

Float16(Option<f16>)

16bit float

§

Float32(Option<f32>)

32bit float

§

Float64(Option<f64>)

64bit float

§

Decimal128(Option<i128>, u8, i8)

128bit decimal, using the i128 to represent the decimal, precision scale

§

Decimal256(Option<i256>, u8, i8)

256bit decimal, using the i256 to represent the decimal, precision scale

§

Int8(Option<i8>)

signed 8bit int

§

Int16(Option<i16>)

signed 16bit int

§

Int32(Option<i32>)

signed 32bit int

§

Int64(Option<i64>)

signed 64bit int

§

UInt8(Option<u8>)

unsigned 8bit int

§

UInt16(Option<u16>)

unsigned 16bit int

§

UInt32(Option<u32>)

unsigned 32bit int

§

UInt64(Option<u64>)

unsigned 64bit int

§

Utf8(Option<String>)

utf-8 encoded string.

§

LargeUtf8(Option<String>)

utf-8 encoded string representing a LargeString’s arrow type.

§

Binary(Option<Vec<u8>>)

binary

§

FixedSizeBinary(i32, Option<Vec<u8>>)

fixed size binary

§

LargeBinary(Option<Vec<u8>>)

large binary

§

FixedSizeList(Arc<FixedSizeListArray>)

Fixed size list scalar.

The array must be a FixedSizeListArray with length 1.

§

List(Arc<GenericListArray<i32>>)

Represents a single element of a [ListArray] as an [ArrayRef]

The array must be a ListArray with length 1.

§

LargeList(Arc<GenericListArray<i64>>)

The array must be a LargeListArray with length 1.

§

Struct(Arc<StructArray>)

Represents a single element [StructArray] as an [ArrayRef]. See ScalarValue for examples of how to create instances of this type.

§

Date32(Option<i32>)

Date stored as a signed 32bit int days since UNIX epoch 1970-01-01

§

Date64(Option<i64>)

Date stored as a signed 64bit int milliseconds since UNIX epoch 1970-01-01

§

Time32Second(Option<i32>)

Time stored as a signed 32bit int as seconds since midnight

§

Time32Millisecond(Option<i32>)

Time stored as a signed 32bit int as milliseconds since midnight

§

Time64Microsecond(Option<i64>)

Time stored as a signed 64bit int as microseconds since midnight

§

Time64Nanosecond(Option<i64>)

Time stored as a signed 64bit int as nanoseconds since midnight

§

TimestampSecond(Option<i64>, Option<Arc<str>>)

Timestamp Second

§

TimestampMillisecond(Option<i64>, Option<Arc<str>>)

Timestamp Milliseconds

§

TimestampMicrosecond(Option<i64>, Option<Arc<str>>)

Timestamp Microseconds

§

TimestampNanosecond(Option<i64>, Option<Arc<str>>)

Timestamp Nanoseconds

§

IntervalYearMonth(Option<i32>)

Number of elapsed whole months

§

IntervalDayTime(Option<i64>)

Number of elapsed days and milliseconds (no leap seconds) stored as 2 contiguous 32-bit signed integers

§

IntervalMonthDayNano(Option<i128>)

A triple of the number of elapsed months, days, and nanoseconds. Months and days are encoded as 32-bit signed integers. Nanoseconds is encoded as a 64-bit signed integer (no leap seconds).

§

DurationSecond(Option<i64>)

Duration in seconds

§

DurationMillisecond(Option<i64>)

Duration in milliseconds

§

DurationMicrosecond(Option<i64>)

Duration in microseconds

§

DurationNanosecond(Option<i64>)

Duration in nanoseconds

§

Union(Option<(i8, Box<ScalarValue>)>, UnionFields, UnionMode)

A nested datatype that can represent slots of differing types. Components: .0: a tuple of union type_id and the single value held by this Scalar .1: the list of fields, zero-to-one of which will by set in .0 .2: the physical storage of the source/destination UnionArray from which this Scalar came

§

Dictionary(Box<DataType>, Box<ScalarValue>)

Dictionary type: index type and value

Implementations§

§

impl ScalarValue

pub fn new_primitive<T>( a: Option<<T as ArrowPrimitiveType>::Native>, d: &DataType, ) -> Result<ScalarValue, DataFusionError>
where T: ArrowPrimitiveType,

Create a [Result<ScalarValue>] with the provided value and datatype

§Panics

Panics if d is not compatible with T

pub fn try_new_decimal128( value: i128, precision: u8, scale: i8, ) -> Result<ScalarValue, DataFusionError>

Create a decimal Scalar from value/precision and scale.

pub fn new_utf8(val: impl Into<String>) -> ScalarValue

Returns a ScalarValue::Utf8 representing val

pub fn new_interval_ym(years: i32, months: i32) -> ScalarValue

Returns a ScalarValue::IntervalYearMonth representing years years and months months

pub fn new_interval_dt(days: i32, millis: i32) -> ScalarValue

Returns a ScalarValue::IntervalDayTime representing days days and millis milliseconds

pub fn new_interval_mdn(months: i32, days: i32, nanos: i64) -> ScalarValue

Returns a ScalarValue::IntervalMonthDayNano representing months months and days days, and nanos nanoseconds

pub fn new_timestamp<T>( value: Option<i64>, tz_opt: Option<Arc<str>>, ) -> ScalarValue
where T: ArrowTimestampType,

Returns a ScalarValue representing value and tz_opt timezone

pub fn new_zero(datatype: &DataType) -> Result<ScalarValue, DataFusionError>

Create a zero value in the given type.

pub fn new_one(datatype: &DataType) -> Result<ScalarValue, DataFusionError>

Create an one value in the given type.

pub fn new_negative_one( datatype: &DataType, ) -> Result<ScalarValue, DataFusionError>

Create a negative one value in the given type.

pub fn new_ten(datatype: &DataType) -> Result<ScalarValue, DataFusionError>

pub fn data_type(&self) -> DataType

return the [DataType] of this ScalarValue

pub fn get_datatype(&self) -> DataType

👎Deprecated since 31.0.0: use data_type instead

Getter for the DataType of the value.

Suggest using Self::data_type as a more standard API

pub fn arithmetic_negate(&self) -> Result<ScalarValue, DataFusionError>

Calculate arithmetic negation for a scalar value

pub fn add<T>(&self, other: T) -> Result<ScalarValue, DataFusionError>
where T: Borrow<ScalarValue>,

Wrapping addition of ScalarValue

NB: operating on ScalarValue directly is not efficient, performance sensitive code should operate on Arrays directly, using vectorized array kernels

pub fn add_checked<T>(&self, other: T) -> Result<ScalarValue, DataFusionError>
where T: Borrow<ScalarValue>,

Checked addition of ScalarValue

NB: operating on ScalarValue directly is not efficient, performance sensitive code should operate on Arrays directly, using vectorized array kernels

pub fn sub<T>(&self, other: T) -> Result<ScalarValue, DataFusionError>
where T: Borrow<ScalarValue>,

Wrapping subtraction of ScalarValue

NB: operating on ScalarValue directly is not efficient, performance sensitive code should operate on Arrays directly, using vectorized array kernels

pub fn sub_checked<T>(&self, other: T) -> Result<ScalarValue, DataFusionError>
where T: Borrow<ScalarValue>,

Checked subtraction of ScalarValue

NB: operating on ScalarValue directly is not efficient, performance sensitive code should operate on Arrays directly, using vectorized array kernels

pub fn mul<T>(&self, other: T) -> Result<ScalarValue, DataFusionError>
where T: Borrow<ScalarValue>,

Wrapping multiplication of ScalarValue

NB: operating on ScalarValue directly is not efficient, performance sensitive code should operate on Arrays directly, using vectorized array kernels.

pub fn mul_checked<T>(&self, other: T) -> Result<ScalarValue, DataFusionError>
where T: Borrow<ScalarValue>,

Checked multiplication of ScalarValue

NB: operating on ScalarValue directly is not efficient, performance sensitive code should operate on Arrays directly, using vectorized array kernels.

pub fn div<T>(&self, other: T) -> Result<ScalarValue, DataFusionError>
where T: Borrow<ScalarValue>,

Performs lhs / rhs

Overflow or division by zero will result in an error, with exception to floating point numbers, which instead follow the IEEE 754 rules.

NB: operating on ScalarValue directly is not efficient, performance sensitive code should operate on Arrays directly, using vectorized array kernels.

pub fn rem<T>(&self, other: T) -> Result<ScalarValue, DataFusionError>
where T: Borrow<ScalarValue>,

Performs lhs % rhs

Overflow or division by zero will result in an error, with exception to floating point numbers, which instead follow the IEEE 754 rules.

NB: operating on ScalarValue directly is not efficient, performance sensitive code should operate on Arrays directly, using vectorized array kernels.

pub fn is_unsigned(&self) -> bool

pub fn is_null(&self) -> bool

whether this value is null or not.

pub fn distance(&self, other: &ScalarValue) -> Option<usize>

Absolute distance between two numeric values (of the same type). This method will return None if either one of the arguments are null. It might also return None if the resulting distance is greater than usize::MAX. If the type is a float, then the distance will be rounded to the nearest integer.

Note: the datatype itself must support subtraction.

pub fn to_array(&self) -> Result<Arc<dyn Array>, DataFusionError>

Converts a scalar value into an 1-row array.

§Errors

Errors if the ScalarValue cannot be converted into a 1-row array

pub fn to_scalar(&self) -> Result<Scalar<Arc<dyn Array>>, DataFusionError>

Converts a scalar into an arrow [Scalar] (which implements the Datum interface).

This can be used to call arrow compute kernels such as lt

§Errors

Errors if the ScalarValue cannot be converted into a 1-row array

§Example
use datafusion_common::ScalarValue;
use arrow::array::{BooleanArray, Int32Array};

let arr = Int32Array::from(vec![Some(1), None, Some(10)]);
let five = ScalarValue::Int32(Some(5));

let result = arrow::compute::kernels::cmp::lt(
  &arr,
  &five.to_scalar().unwrap(),
).unwrap();

let expected = BooleanArray::from(vec![
    Some(true),
    None,
    Some(false)
  ]
);

assert_eq!(&result, &expected);

pub fn iter_to_array( scalars: impl IntoIterator<Item = ScalarValue>, ) -> Result<Arc<dyn Array>, DataFusionError>

Converts an iterator of references ScalarValue into an [ArrayRef] corresponding to those values. For example, an iterator of ScalarValue::Int32 would be converted to an [Int32Array].

Returns an error if the iterator is empty or if the ScalarValues are not all the same type

§Panics

Panics if self is a dictionary with invalid key type

§Example
use datafusion_common::ScalarValue;
use arrow::array::{ArrayRef, BooleanArray};

let scalars = vec![
  ScalarValue::Boolean(Some(true)),
  ScalarValue::Boolean(None),
  ScalarValue::Boolean(Some(false)),
];

// Build an Array from the list of ScalarValues
let array = ScalarValue::iter_to_array(scalars.into_iter())
  .unwrap();

let expected: ArrayRef = std::sync::Arc::new(
  BooleanArray::from(vec![
    Some(true),
    None,
    Some(false)
  ]
));

assert_eq!(&array, &expected);

pub fn new_list( values: &[ScalarValue], data_type: &DataType, ) -> Arc<GenericListArray<i32>>

Converts Vec<ScalarValue> where each element has type corresponding to data_type, to a single element [ListArray].

Example

use datafusion_common::ScalarValue;
use arrow::array::{ListArray, Int32Array};
use arrow::datatypes::{DataType, Int32Type};
use datafusion_common::cast::as_list_array;

let scalars = vec![
   ScalarValue::Int32(Some(1)),
   ScalarValue::Int32(None),
   ScalarValue::Int32(Some(2))
];

let result = ScalarValue::new_list(&scalars, &DataType::Int32);

let expected = ListArray::from_iter_primitive::<Int32Type, _, _>(
    vec![
       Some(vec![Some(1), None, Some(2)])
    ]);

assert_eq!(*result, expected);

pub fn new_list_from_iter( values: impl IntoIterator<Item = ScalarValue> + ExactSizeIterator, data_type: &DataType, ) -> Arc<GenericListArray<i32>>

Converts IntoIterator<Item = ScalarValue> where each element has type corresponding to data_type, to a [ListArray].

Example

use datafusion_common::ScalarValue;
use arrow::array::{ListArray, Int32Array};
use arrow::datatypes::{DataType, Int32Type};
use datafusion_common::cast::as_list_array;

let scalars = vec![
   ScalarValue::Int32(Some(1)),
   ScalarValue::Int32(None),
   ScalarValue::Int32(Some(2))
];

let result = ScalarValue::new_list_from_iter(scalars.into_iter(), &DataType::Int32);

let expected = ListArray::from_iter_primitive::<Int32Type, _, _>(
    vec![
       Some(vec![Some(1), None, Some(2)])
    ]);

assert_eq!(*result, expected);

pub fn new_large_list( values: &[ScalarValue], data_type: &DataType, ) -> Arc<GenericListArray<i64>>

Converts Vec<ScalarValue> where each element has type corresponding to data_type, to a [LargeListArray].

Example

use datafusion_common::ScalarValue;
use arrow::array::{LargeListArray, Int32Array};
use arrow::datatypes::{DataType, Int32Type};
use datafusion_common::cast::as_large_list_array;

let scalars = vec![
   ScalarValue::Int32(Some(1)),
   ScalarValue::Int32(None),
   ScalarValue::Int32(Some(2))
];

let result = ScalarValue::new_large_list(&scalars, &DataType::Int32);

let expected = LargeListArray::from_iter_primitive::<Int32Type, _, _>(
    vec![
       Some(vec![Some(1), None, Some(2)])
    ]);

assert_eq!(*result, expected);

pub fn to_array_of_size( &self, size: usize, ) -> Result<Arc<dyn Array>, DataFusionError>

Converts a scalar value into an array of size rows.

§Errors

Errors if self is

  • a decimal that fails be converted to a decimal array of size
  • a Fixedsizelist that fails to be concatenated into an array of size
  • a List that fails to be concatenated into an array of size
  • a Dictionary that fails be converted to a dictionary array of size

pub fn convert_array_to_scalar_vec( array: &dyn Array, ) -> Result<Vec<Vec<ScalarValue>>, DataFusionError>

Retrieve ScalarValue for each row in array

Example 1: Array (ScalarValue::Int32)

use datafusion_common::ScalarValue;
use arrow::array::ListArray;
use arrow::datatypes::{DataType, Int32Type};

// Equivalent to [[1,2,3], [4,5]]
let list_arr = ListArray::from_iter_primitive::<Int32Type, _, _>(vec![
   Some(vec![Some(1), Some(2), Some(3)]),
   Some(vec![Some(4), Some(5)])
]);

// Convert the array into Scalar Values for each row
let scalar_vec = ScalarValue::convert_array_to_scalar_vec(&list_arr).unwrap();

let expected = vec![
vec![
    ScalarValue::Int32(Some(1)),
    ScalarValue::Int32(Some(2)),
    ScalarValue::Int32(Some(3)),
],
vec![
   ScalarValue::Int32(Some(4)),
   ScalarValue::Int32(Some(5)),
],
];

assert_eq!(scalar_vec, expected);

Example 2: Nested array (ScalarValue::List)

use datafusion_common::ScalarValue;
use arrow::array::ListArray;
use arrow::datatypes::{DataType, Int32Type};
use datafusion_common::utils::array_into_list_array;
use std::sync::Arc;

let list_arr = ListArray::from_iter_primitive::<Int32Type, _, _>(vec![
   Some(vec![Some(1), Some(2), Some(3)]),
   Some(vec![Some(4), Some(5)])
]);

// Wrap into another layer of list, we got nested array as [ [[1,2,3], [4,5]] ]
let list_arr = array_into_list_array(Arc::new(list_arr));

// Convert the array into Scalar Values for each row, we got 1D arrays in this example
let scalar_vec = ScalarValue::convert_array_to_scalar_vec(&list_arr).unwrap();

let l1 = ListArray::from_iter_primitive::<Int32Type, _, _>(vec![
    Some(vec![Some(1), Some(2), Some(3)]),
]);
let l2 = ListArray::from_iter_primitive::<Int32Type, _, _>(vec![
    Some(vec![Some(4), Some(5)]),
]);

let expected = vec![
  vec![
    ScalarValue::List(Arc::new(l1)),
    ScalarValue::List(Arc::new(l2)),
  ],
];

assert_eq!(scalar_vec, expected);

pub fn raw_data(&self) -> Result<Arc<dyn Array>, DataFusionError>

Get raw data (inner array) inside ScalarValue

pub fn try_from_array( array: &dyn Array, index: usize, ) -> Result<ScalarValue, DataFusionError>

Converts a value in array at index into a ScalarValue

pub fn try_from_string( value: String, target_type: &DataType, ) -> Result<ScalarValue, DataFusionError>

Try to parse value into a ScalarValue of type target_type

pub fn cast_to( &self, data_type: &DataType, ) -> Result<ScalarValue, DataFusionError>

Try to cast this value to a ScalarValue of type data_type

pub fn eq_array( &self, array: &Arc<dyn Array>, index: usize, ) -> Result<bool, DataFusionError>

Compares a single row of array @ index for equality with self, in an optimized fashion.

This method implements an optimized version of:

    let arr_scalar = Self::try_from_array(array, index).unwrap();
    arr_scalar.eq(self)

Performance note: the arrow compute kernels should be preferred over this function if at all possible as they can be vectorized and are generally much faster.

This function has a few narrow usescases such as hash table key comparisons where comparing a single row at a time is necessary.

§Errors

Errors if

  • it fails to downcast array to the data type of self
  • self is a Struct
§Panics

Panics if self is a dictionary with invalid key type

pub fn size(&self) -> usize

Estimate size if bytes including Self. For values with internal containers such as String includes the allocated size (capacity) rather than the current length (len)

pub fn size_of_vec(vec: &Vec<ScalarValue>) -> usize

Estimates size of Vec in bytes.

Includes the size of the Vec container itself.

pub fn size_of_vec_deque(vec_deque: &VecDeque<ScalarValue>) -> usize

Estimates size of VecDeque in bytes.

Includes the size of the VecDeque container itself.

pub fn size_of_hashset<S>(set: &HashSet<ScalarValue, S>) -> usize

Estimates size of HashSet in bytes.

Includes the size of the HashSet container itself.

Trait Implementations§

§

impl Clone for ScalarValue

§

fn clone(&self) -> ScalarValue

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for ScalarValue

§

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

Formats the value using the given formatter. Read more
§

impl Display for ScalarValue

§

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

Formats the value using the given formatter. Read more
§

impl<T> From<&HyperLogLog<T>> for ScalarValue
where T: Hash,

§

fn from(v: &HyperLogLog<T>) -> ScalarValue

Converts to this type from the input type.
§

impl From<&str> for ScalarValue

§

fn from(value: &str) -> ScalarValue

Converts to this type from the input type.
§

impl From<Option<&str>> for ScalarValue

§

fn from(value: Option<&str>) -> ScalarValue

Converts to this type from the input type.
§

impl From<Option<bool>> for ScalarValue

§

fn from(value: Option<bool>) -> ScalarValue

Converts to this type from the input type.
§

impl From<Option<f32>> for ScalarValue

§

fn from(value: Option<f32>) -> ScalarValue

Converts to this type from the input type.
§

impl From<Option<f64>> for ScalarValue

§

fn from(value: Option<f64>) -> ScalarValue

Converts to this type from the input type.
§

impl From<Option<i16>> for ScalarValue

§

fn from(value: Option<i16>) -> ScalarValue

Converts to this type from the input type.
§

impl From<Option<i32>> for ScalarValue

§

fn from(value: Option<i32>) -> ScalarValue

Converts to this type from the input type.
§

impl From<Option<i64>> for ScalarValue

§

fn from(value: Option<i64>) -> ScalarValue

Converts to this type from the input type.
§

impl From<Option<i8>> for ScalarValue

§

fn from(value: Option<i8>) -> ScalarValue

Converts to this type from the input type.
§

impl From<Option<u16>> for ScalarValue

§

fn from(value: Option<u16>) -> ScalarValue

Converts to this type from the input type.
§

impl From<Option<u32>> for ScalarValue

§

fn from(value: Option<u32>) -> ScalarValue

Converts to this type from the input type.
§

impl From<Option<u64>> for ScalarValue

§

fn from(value: Option<u64>) -> ScalarValue

Converts to this type from the input type.
§

impl From<Option<u8>> for ScalarValue

§

fn from(value: Option<u8>) -> ScalarValue

Converts to this type from the input type.
§

impl From<String> for ScalarValue

§

fn from(value: String) -> ScalarValue

Converts to this type from the input type.
§

impl From<Vec<(&str, ScalarValue)>> for ScalarValue

Wrapper to create ScalarValue::Struct for convenience

§

fn from(value: Vec<(&str, ScalarValue)>) -> ScalarValue

Converts to this type from the input type.
§

impl From<bool> for ScalarValue

§

fn from(value: bool) -> ScalarValue

Converts to this type from the input type.
§

impl From<f32> for ScalarValue

§

fn from(value: f32) -> ScalarValue

Converts to this type from the input type.
§

impl From<f64> for ScalarValue

§

fn from(value: f64) -> ScalarValue

Converts to this type from the input type.
§

impl From<i16> for ScalarValue

§

fn from(value: i16) -> ScalarValue

Converts to this type from the input type.
§

impl From<i32> for ScalarValue

§

fn from(value: i32) -> ScalarValue

Converts to this type from the input type.
§

impl From<i64> for ScalarValue

§

fn from(value: i64) -> ScalarValue

Converts to this type from the input type.
§

impl From<i8> for ScalarValue

§

fn from(value: i8) -> ScalarValue

Converts to this type from the input type.
§

impl From<u16> for ScalarValue

§

fn from(value: u16) -> ScalarValue

Converts to this type from the input type.
§

impl From<u32> for ScalarValue

§

fn from(value: u32) -> ScalarValue

Converts to this type from the input type.
§

impl From<u64> for ScalarValue

§

fn from(value: u64) -> ScalarValue

Converts to this type from the input type.
§

impl From<u8> for ScalarValue

§

fn from(value: u8) -> ScalarValue

Converts to this type from the input type.
§

impl FromStr for ScalarValue

§

type Err = Infallible

The associated error which can be returned from parsing.
§

fn from_str(s: &str) -> Result<ScalarValue, <ScalarValue as FromStr>::Err>

Parses a string s to return a value of this type. Read more
§

impl Hash for ScalarValue

§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

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

impl Literal for ScalarValue

§

fn lit(&self) -> Expr

convert the value to a Literal expression
§

impl PartialEq for ScalarValue

§

fn eq(&self, other: &ScalarValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialOrd for ScalarValue

§

fn partial_cmp(&self, other: &ScalarValue) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl TryFrom<&DataType> for ScalarValue

§

fn try_from(data_type: &DataType) -> Result<ScalarValue, DataFusionError>

Create a Null instance of ScalarValue for this datatype

§

type Error = DataFusionError

The type returned in the event of a conversion error.
§

impl TryFrom<DataType> for ScalarValue

§

fn try_from(datatype: DataType) -> Result<ScalarValue, DataFusionError>

Create a Null instance of ScalarValue for this datatype

§

type Error = DataFusionError

The type returned in the event of a conversion error.
§

impl TryFrom<ScalarValue> for bool

§

type Error = DataFusionError

The type returned in the event of a conversion error.
§

fn try_from(value: ScalarValue) -> Result<bool, DataFusionError>

Performs the conversion.
§

impl TryFrom<ScalarValue> for u32

§

type Error = DataFusionError

The type returned in the event of a conversion error.
§

fn try_from(value: ScalarValue) -> Result<u32, DataFusionError>

Performs the conversion.
§

impl Eq for ScalarValue

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
§

impl<T> CallHasher for T
where T: Hash + ?Sized,

§

default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64
where H: Hash + ?Sized, B: BuildHasher,

source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T, V> Convert<T> for V
where V: Into<T>,

§

fn convert(value: Self) -> T

§

fn convert_box(value: Box<Self>) -> Box<T>

§

fn convert_vec(value: Vec<Self>) -> Vec<T>

§

fn convert_vec_box(value: Vec<Box<Self>>) -> Vec<Box<T>>

§

fn convert_matrix(value: Vec<Vec<Self>>) -> Vec<Vec<T>>

§

fn convert_option(value: Option<Self>) -> Option<T>

§

fn convert_option_box(value: Option<Box<Self>>) -> Option<Box<T>>

§

fn convert_option_vec(value: Option<Vec<Self>>) -> Option<Vec<T>>

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

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

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

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

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

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

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

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

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> Any for T
where T: Any,

§

impl<T> CloneAny for T
where T: Any + Clone,

§

impl<T> CloneAnySend for T
where T: Any + Send + Clone,

§

impl<T> CloneAnySendSync for T
where T: Any + Send + Sync + Clone,

§

impl<T> CloneAnySync for T
where T: Any + Sync + Clone,

source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,