Scalars

struct arrow::Scalar : public arrow::util::EqualityComparable<Scalar>

Base class for scalar values.

A Scalar represents a single value with a specific DataType. Scalars are useful for passing single value inputs to compute functions, or for representing individual array elements (with a non-trivial wrapping cost, though).

Subclassed by arrow::BaseBinaryScalar, arrow::BaseListScalar, arrow::Decimal128Scalar, arrow::Decimal256Scalar, arrow::DictionaryScalar, arrow::ExtensionScalar, arrow::internal::PrimitiveScalarBase, arrow::NullScalar, arrow::StructScalar, arrow::UnionScalar

Public Members

std::shared_ptr<DataType> type

The type of the scalar value.

bool is_valid = false

Whether the value is valid (not null) or not.

struct Hash

Factory functions

std::shared_ptr<Scalar> MakeNullScalar(std::shared_ptr<DataType> type)

Scalar factory for null scalars.

template<typename Value>
Result<std::shared_ptr<Scalar>> MakeScalar(std::shared_ptr<DataType> type, Value &&value)

Scalar factory for non-null scalars.

template<typename Value, typename Traits = CTypeTraits<typename std::decay<Value>::type>, typename ScalarType = typename Traits::ScalarType, typename Enable = decltype(ScalarType(std::declval<Value>(), Traits::type_singleton()))>
std::shared_ptr<Scalar> MakeScalar(Value value)

Type-inferring scalar factory for non-null scalars.

Construct a Scalar instance with a DataType determined by the input C++ type. (for example Int8Scalar for a int8_t input). Only non-parametric primitive types and String are supported.

std::shared_ptr<Scalar> MakeScalar(std::string value)

Concrete scalar subclasses

struct arrow::NullScalar : public arrow::Scalar
#include <arrow/scalar.h>

A scalar value for NullType. Never valid.

Public Types

using TypeClass = NullType

Public Functions

NullScalar()
struct arrow::BooleanScalar : public arrow::internal::PrimitiveScalar<BooleanType, bool>
#include <arrow/scalar.h>

Public Types

using Base = internal::PrimitiveScalar<BooleanType, bool>

Public Functions

BooleanScalar(bool value)
BooleanScalar()
template<typename T>
struct arrow::NumericScalar : public arrow::internal::PrimitiveScalar<T>
#include <arrow/scalar.h>

Public Types

using Base = typename internal::PrimitiveScalar<T>
using TypeClass = typename Base::TypeClass
using ValueType = typename Base::ValueType

Public Functions

NumericScalar(ValueType value)
NumericScalar()
struct Int8Scalar : public arrow::NumericScalar<Int8Type>
#include <arrow/scalar.h>
struct Int16Scalar : public arrow::NumericScalar<Int16Type>
#include <arrow/scalar.h>
struct Int32Scalar : public arrow::NumericScalar<Int32Type>
#include <arrow/scalar.h>
struct Int64Scalar : public arrow::NumericScalar<Int64Type>
#include <arrow/scalar.h>
struct UInt8Scalar : public arrow::NumericScalar<UInt8Type>
#include <arrow/scalar.h>
struct UInt16Scalar : public arrow::NumericScalar<UInt16Type>
#include <arrow/scalar.h>
struct UInt32Scalar : public arrow::NumericScalar<UInt32Type>
#include <arrow/scalar.h>
struct UInt64Scalar : public arrow::NumericScalar<UInt64Type>
#include <arrow/scalar.h>
struct HalfFloatScalar : public arrow::NumericScalar<HalfFloatType>
#include <arrow/scalar.h>
struct FloatScalar : public arrow::NumericScalar<FloatType>
#include <arrow/scalar.h>
struct DoubleScalar : public arrow::NumericScalar<DoubleType>
#include <arrow/scalar.h>
struct arrow::BaseBinaryScalar : public arrow::Scalar
#include <arrow/scalar.h>

Subclassed by arrow::BinaryScalar, arrow::LargeBinaryScalar

Public Types

using ValueType = std::shared_ptr<Buffer>

Public Functions

Scalar(std::shared_ptr<DataType> type)
Scalar(std::shared_ptr<DataType> type, bool is_valid)

Public Members

std::shared_ptr<Buffer> value
struct arrow::BinaryScalar : public arrow::BaseBinaryScalar
#include <arrow/scalar.h>

Subclassed by arrow::FixedSizeBinaryScalar, arrow::StringScalar

Public Types

using TypeClass = BinaryType

Public Functions

BinaryScalar(std::shared_ptr<Buffer> value, std::shared_ptr<DataType> type)
BinaryScalar(std::shared_ptr<Buffer> value)
BinaryScalar()
BaseBinaryScalar(std::shared_ptr<Buffer> value, std::shared_ptr<DataType> type)
struct arrow::StringScalar : public arrow::BinaryScalar
#include <arrow/scalar.h>

Public Types

using TypeClass = StringType

Public Functions

StringScalar(std::shared_ptr<Buffer> value)
StringScalar(std::string s)
StringScalar()
BinaryScalar(std::shared_ptr<Buffer> value, std::shared_ptr<DataType> type)
BinaryScalar(std::shared_ptr<Buffer> value)
BinaryScalar()
struct arrow::LargeBinaryScalar : public arrow::BaseBinaryScalar
#include <arrow/scalar.h>

Subclassed by arrow::LargeStringScalar

Public Types

using TypeClass = LargeBinaryType

Public Functions

LargeBinaryScalar(std::shared_ptr<Buffer> value, std::shared_ptr<DataType> type)
LargeBinaryScalar(std::shared_ptr<Buffer> value)
LargeBinaryScalar()
BaseBinaryScalar(std::shared_ptr<Buffer> value, std::shared_ptr<DataType> type)
struct arrow::LargeStringScalar : public arrow::LargeBinaryScalar
#include <arrow/scalar.h>

Public Types

using TypeClass = LargeStringType

Public Functions

LargeStringScalar(std::shared_ptr<Buffer> value)
LargeStringScalar(std::string s)
LargeStringScalar()
LargeBinaryScalar(std::shared_ptr<Buffer> value, std::shared_ptr<DataType> type)
LargeBinaryScalar(std::shared_ptr<Buffer> value)
LargeBinaryScalar()
struct arrow::FixedSizeBinaryScalar : public arrow::BinaryScalar
#include <arrow/scalar.h>

Public Types

using TypeClass = FixedSizeBinaryType

Public Functions

FixedSizeBinaryScalar(std::shared_ptr<Buffer> value, std::shared_ptr<DataType> type)
FixedSizeBinaryScalar(std::shared_ptr<DataType> type)
template<typename T>
struct arrow::TemporalScalar : public arrow::internal::PrimitiveScalar<T>
#include <arrow/scalar.h>

Subclassed by arrow::DateScalar< T >, arrow::IntervalScalar< T >, arrow::TimeScalar< T >

Public Types

using ValueType = typename TemporalScalar<T>::ValueType

Public Functions

TemporalScalar(ValueType value, std::shared_ptr<DataType> type)
template<typename T>
struct arrow::DateScalar : public arrow::TemporalScalar<T>
#include <arrow/scalar.h>

Public Types

using ValueType = typename TemporalScalar<T>::ValueType

Public Functions

DateScalar(ValueType value)
DateScalar()
struct Date32Scalar : public arrow::DateScalar<Date32Type>
#include <arrow/scalar.h>
struct Date64Scalar : public arrow::DateScalar<Date64Type>
#include <arrow/scalar.h>
template<typename T>
struct TimeScalar : public arrow::TemporalScalar<T>
#include <arrow/scalar.h>
struct Time32Scalar : public arrow::TimeScalar<Time32Type>
#include <arrow/scalar.h>
struct Time64Scalar : public arrow::TimeScalar<Time64Type>
#include <arrow/scalar.h>
struct TimestampScalar : public arrow::TemporalScalar<TimestampType>
#include <arrow/scalar.h>
template<typename T>
struct arrow::IntervalScalar : public arrow::TemporalScalar<T>
#include <arrow/scalar.h>

Public Types

using ValueType = typename TemporalScalar<T>::ValueType

Public Functions

IntervalScalar(ValueType value)
IntervalScalar()
struct MonthIntervalScalar : public arrow::IntervalScalar<MonthIntervalType>
#include <arrow/scalar.h>
struct DayTimeIntervalScalar : public arrow::IntervalScalar<DayTimeIntervalType>
#include <arrow/scalar.h>
struct DurationScalar : public arrow::TemporalScalar<DurationType>
#include <arrow/scalar.h>
struct arrow::Decimal128Scalar : public arrow::Scalar
#include <arrow/scalar.h>

Public Types

using TypeClass = Decimal128Type
using ValueType = Decimal128

Public Functions

Decimal128Scalar(Decimal128 value, std::shared_ptr<DataType> type)
Scalar(std::shared_ptr<DataType> type)
Scalar(std::shared_ptr<DataType> type, bool is_valid)

Public Members

Decimal128 value
struct arrow::Decimal256Scalar : public arrow::Scalar
#include <arrow/scalar.h>

Public Types

using TypeClass = Decimal256Type
using ValueType = Decimal256

Public Functions

Decimal256Scalar(Decimal256 value, std::shared_ptr<DataType> type)
Scalar(std::shared_ptr<DataType> type)
Scalar(std::shared_ptr<DataType> type, bool is_valid)

Public Members

Decimal256 value
struct arrow::BaseListScalar : public arrow::Scalar
#include <arrow/scalar.h>

Subclassed by arrow::FixedSizeListScalar, arrow::LargeListScalar, arrow::ListScalar, arrow::MapScalar

Public Types

using ValueType = std::shared_ptr<Array>

Public Functions

BaseListScalar(std::shared_ptr<Array> value, std::shared_ptr<DataType> type)
Scalar(std::shared_ptr<DataType> type)
Scalar(std::shared_ptr<DataType> type, bool is_valid)

Public Members

std::shared_ptr<Array> value
struct arrow::ListScalar : public arrow::BaseListScalar
#include <arrow/scalar.h>

Public Types

using TypeClass = ListType

Public Functions

ListScalar(std::shared_ptr<Array> value)
BaseListScalar(std::shared_ptr<Array> value, std::shared_ptr<DataType> type)
struct arrow::LargeListScalar : public arrow::BaseListScalar
#include <arrow/scalar.h>

Public Types

using TypeClass = LargeListType

Public Functions

LargeListScalar(std::shared_ptr<Array> value)
BaseListScalar(std::shared_ptr<Array> value, std::shared_ptr<DataType> type)
struct arrow::MapScalar : public arrow::BaseListScalar
#include <arrow/scalar.h>

Public Types

using TypeClass = MapType

Public Functions

MapScalar(std::shared_ptr<Array> value)
BaseListScalar(std::shared_ptr<Array> value, std::shared_ptr<DataType> type)
struct arrow::FixedSizeListScalar : public arrow::BaseListScalar
#include <arrow/scalar.h>

Public Types

using TypeClass = FixedSizeListType

Public Functions

FixedSizeListScalar(std::shared_ptr<Array> value, std::shared_ptr<DataType> type)
FixedSizeListScalar(std::shared_ptr<Array> value)
BaseListScalar(std::shared_ptr<Array> value, std::shared_ptr<DataType> type)
struct arrow::StructScalar : public arrow::Scalar
#include <arrow/scalar.h>

Public Types

using TypeClass = StructType
using ValueType = std::vector<std::shared_ptr<Scalar>>

Public Functions

Result<std::shared_ptr<Scalar>> field(FieldRef ref) const
StructScalar(ValueType value, std::shared_ptr<DataType> type)
StructScalar(std::shared_ptr<DataType> type)

Public Members

ScalarVector value

Public Static Functions

Result<std::shared_ptr<StructScalar>> Make(ValueType value, std::vector<std::string> field_names)
struct arrow::UnionScalar : public arrow::Scalar
#include <arrow/scalar.h>

Subclassed by arrow::DenseUnionScalar, arrow::SparseUnionScalar

Public Types

using ValueType = std::shared_ptr<Scalar>

Public Functions

UnionScalar(ValueType value, std::shared_ptr<DataType> type)
Scalar(std::shared_ptr<DataType> type)
Scalar(std::shared_ptr<DataType> type, bool is_valid)

Public Members

ValueType value
struct arrow::SparseUnionScalar : public arrow::UnionScalar
#include <arrow/scalar.h>

Public Types

using TypeClass = SparseUnionType

Public Functions

UnionScalar(ValueType value, std::shared_ptr<DataType> type)
struct arrow::DenseUnionScalar : public arrow::UnionScalar
#include <arrow/scalar.h>

Public Types

using TypeClass = DenseUnionType

Public Functions

UnionScalar(ValueType value, std::shared_ptr<DataType> type)
struct arrow::DictionaryScalar : public arrow::Scalar
#include <arrow/scalar.h>

Public Types

using TypeClass = DictionaryType

Public Functions

DictionaryScalar(std::shared_ptr<DataType> type)
DictionaryScalar(ValueType value, std::shared_ptr<DataType> type, bool is_valid = true)
Result<std::shared_ptr<Scalar>> GetEncodedValue() const

Public Members

struct arrow::DictionaryScalar::ValueType value
struct ValueType
#include <arrow/scalar.h>

Public Members

std::shared_ptr<Scalar> index
std::shared_ptr<Array> dictionary
struct arrow::ExtensionScalar : public arrow::Scalar
#include <arrow/scalar.h>

Public Types

using TypeClass = ExtensionType

Public Functions

Scalar(std::shared_ptr<DataType> type)
Scalar(std::shared_ptr<DataType> type, bool is_valid)