Scalars

struct 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::NullScalar, arrow::StructScalar, arrow::UnionScalar, arrow::internal::PrimitiveScalarBase

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.

Factory functions

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

Scalar factory for null scalars.

template<typename Value>
Result<std::shared_ptr<Scalar>> arrow::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> arrow::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> arrow::MakeScalar(std::string value)

Concrete scalar subclasses

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

A scalar value for NullType. Never valid.

Public Types

using TypeClass = NullType

Public Functions

NullScalar()
struct 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 NumericScalar : public arrow::internal::PrimitiveScalar<T>
#include <arrow/scalar.h>

Public Types

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

Public Functions

NumericScalar(ValueType value)
NumericScalar()
struct 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 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 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 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 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 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 TemporalScalar : public arrow::internal::PrimitiveScalar<T>
#include <arrow/scalar.h>

Subclassed by arrow::DateScalar< Date64Type >, arrow::DateScalar< Date32Type >, arrow::IntervalScalar< MonthIntervalType >, arrow::IntervalScalar< DayTimeIntervalType >, arrow::TimeScalar< Time64Type >, arrow::TimeScalar< Time32Type >, arrow::DateScalar< T >, arrow::IntervalScalar< T >, arrow::TimeScalar< T >

Public Types

template<>
using ValueType = typename TemporalScalar::ValueType

Public Functions

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

Public Types

template<>
using ValueType = typename TemporalScalar::ValueType

Public Functions

DateScalar(ValueType value)
DateScalar()
template<typename T>
struct IntervalScalar : public arrow::TemporalScalar<T>
#include <arrow/scalar.h>

Public Types

template<>
using ValueType = typename TemporalScalar::ValueType

Public Functions

IntervalScalar(ValueType value)
IntervalScalar()
struct 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 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 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 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 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 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 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 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

static Result<std::shared_ptr<StructScalar>> Make(ValueType value, std::vector<std::string> field_names)
struct 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 SparseUnionScalar : public arrow::UnionScalar
#include <arrow/scalar.h>

Public Types

using TypeClass = SparseUnionType

Public Functions

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

Public Types

using TypeClass = DenseUnionType

Public Functions

UnionScalar(ValueType value, std::shared_ptr<DataType> type)
struct 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

Public Static Functions

static std::shared_ptr<DictionaryScalar> Make(std::shared_ptr<Scalar> index, std::shared_ptr<Array> dict)
struct ValueType
#include <arrow/scalar.h>

Public Members

std::shared_ptr<Scalar> index
std::shared_ptr<Array> dictionary
struct 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)