Scalars#
-
struct Scalar : public std::enable_shared_from_this<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::BaseListScalar, arrow::ExtensionScalar, arrow::NullScalar, arrow::RunEndEncodedScalar, arrow::StructScalar, arrow::UnionScalar, arrow::internal::PrimitiveScalarBase
Public Functions
-
Status Validate() const#
Perform cheap validation checks.
This is O(k) where k is the number of descendents.
- Returns:
-
Status ValidateFull() const#
Perform extensive data validation checks.
This is potentially O(k*n) where k is the number of descendents and n is the length of descendents (if list scalars are involved).
- Returns:
-
Status Accept(ScalarVisitor *visitor) const#
Apply the ScalarVisitor::Visit() method specialized to the scalar type.
EXPERIMENTAL Enable obtaining shared_ptr<Scalar> from a const Scalar& context.
Public Members
-
bool is_valid = false#
Whether the value is valid (not null) or not.
-
struct Hash#
-
Status Validate() const#
Factory functions#
Scalar factory for null scalars.
Scalar factory for non-null scalars.
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.
-
inline std::shared_ptr<Scalar> MakeScalar(std::string value)#
Concrete scalar subclasses#
-
struct NullScalar : public arrow::Scalar#
- #include <arrow/scalar.h>
A scalar value for NullType. Never valid.
Public Functions
-
inline NullScalar()#
-
inline NullScalar()#
-
struct BooleanScalar : public arrow::internal::PrimitiveScalar<BooleanType, bool>#
- #include <arrow/scalar.h>
Public Types
-
using Base = internal::PrimitiveScalar<BooleanType, bool>#
-
using Base = internal::PrimitiveScalar<BooleanType, bool>#
-
template<typename T>
struct NumericScalar : public arrow::internal::PrimitiveScalar<T># - #include <arrow/scalar.h>
Public Types
-
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 BaseBinaryScalar : public arrow::internal::PrimitiveScalarBase, private arrow::internal::ArraySpanFillFromScalarScratchSpace#
- #include <arrow/scalar.h>
Subclassed by arrow::BinaryScalar, arrow::LargeBinaryScalar
-
struct BinaryScalar : public arrow::BaseBinaryScalar#
- #include <arrow/scalar.h>
Subclassed by arrow::FixedSizeBinaryScalar, arrow::StringScalar
Public Types
-
using TypeClass = BinaryType#
-
using TypeClass = BinaryType#
-
struct StringScalar : public arrow::BinaryScalar#
- #include <arrow/scalar.h>
Public Types
-
using TypeClass = StringType#
-
using TypeClass = StringType#
-
struct LargeBinaryScalar : public arrow::BaseBinaryScalar#
- #include <arrow/scalar.h>
Subclassed by arrow::LargeStringScalar
Public Types
-
using TypeClass = LargeBinaryType#
-
using TypeClass = LargeBinaryType#
-
struct LargeStringScalar : public arrow::LargeBinaryScalar#
- #include <arrow/scalar.h>
Public Types
-
using TypeClass = LargeStringType#
-
using TypeClass = LargeStringType#
-
struct FixedSizeBinaryScalar : public arrow::BinaryScalar#
- #include <arrow/scalar.h>
Public Types
-
using TypeClass = FixedSizeBinaryType#
-
using TypeClass = FixedSizeBinaryType#
-
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::IntervalScalar< MonthDayNanoIntervalType >, arrow::TimeScalar< Time64Type >, arrow::TimeScalar< Time32Type >, arrow::DateScalar< T >, arrow::IntervalScalar< T >, arrow::TimeScalar< T >
Public Functions
-
template<typename T>
struct DateScalar : public arrow::TemporalScalar<T># - #include <arrow/scalar.h>
Public Types
-
using ValueType = typename TemporalScalar<T>::ValueType#
-
using ValueType = typename TemporalScalar<T>::ValueType#
-
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>
Public Functions
-
inline TimeScalar(typename TemporalScalar<T>::ValueType value, TimeUnit::type unit)#
-
inline TimeScalar(typename TemporalScalar<T>::ValueType value, TimeUnit::type unit)#
-
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>
Public Functions
-
inline TimestampScalar(typename TemporalScalar<TimestampType>::ValueType value, TimeUnit::type unit, std::string tz = "")#
Public Static Functions
-
static Result<TimestampScalar> FromISO8601(std::string_view iso8601, TimeUnit::type unit)#
-
inline TimestampScalar(typename TemporalScalar<TimestampType>::ValueType value, TimeUnit::type unit, std::string tz = "")#
-
template<typename T>
struct IntervalScalar : public arrow::TemporalScalar<T># - #include <arrow/scalar.h>
Public Types
-
using ValueType = typename TemporalScalar<T>::ValueType#
-
using ValueType = typename TemporalScalar<T>::ValueType#
-
struct MonthIntervalScalar : public arrow::IntervalScalar<MonthIntervalType>#
- #include <arrow/scalar.h>
-
struct DayTimeIntervalScalar : public arrow::IntervalScalar<DayTimeIntervalType>#
- #include <arrow/scalar.h>
-
struct MonthDayNanoIntervalScalar : public arrow::IntervalScalar<MonthDayNanoIntervalType>#
- #include <arrow/scalar.h>
-
struct DurationScalar : public arrow::TemporalScalar<DurationType>#
- #include <arrow/scalar.h>
Public Functions
-
inline DurationScalar(typename TemporalScalar<DurationType>::ValueType value, TimeUnit::type unit)#
-
template<template<typename, typename> class StdDuration, typename Rep>
inline explicit DurationScalar(StdDuration<Rep, std::nano> d)#
-
template<template<typename, typename> class StdDuration, typename Rep>
inline explicit DurationScalar(StdDuration<Rep, std::micro> d)#
-
template<template<typename, typename> class StdDuration, typename Rep>
inline explicit DurationScalar(StdDuration<Rep, std::milli> d)#
-
template<template<typename, typename> class StdDuration, typename Rep, intmax_t Num>
inline explicit DurationScalar(StdDuration<Rep, std::ratio<Num, 1>> d)#
-
inline DurationScalar(typename TemporalScalar<DurationType>::ValueType value, TimeUnit::type unit)#
-
template<typename TYPE_CLASS, typename VALUE_TYPE>
struct DecimalScalar : public arrow::internal::PrimitiveScalarBase# - #include <arrow/scalar.h>
-
struct Decimal128Scalar : public arrow::DecimalScalar<Decimal128Type, Decimal128>#
- #include <arrow/scalar.h>
Public Functions
-
struct Decimal256Scalar : public arrow::DecimalScalar<Decimal256Type, Decimal256>#
- #include <arrow/scalar.h>
Public Functions
-
struct BaseListScalar : public arrow::Scalar, private arrow::internal::ArraySpanFillFromScalarScratchSpace#
- #include <arrow/scalar.h>
Subclassed by arrow::FixedSizeListScalar, arrow::LargeListScalar, arrow::ListScalar, arrow::MapScalar
Public Functions
-
struct ListScalar : public arrow::BaseListScalar#
- #include <arrow/scalar.h>
Public Functions
-
struct LargeListScalar : public arrow::BaseListScalar#
- #include <arrow/scalar.h>
Public Types
-
using TypeClass = LargeListType#
Public Functions
-
using TypeClass = LargeListType#
-
struct MapScalar : public arrow::BaseListScalar#
- #include <arrow/scalar.h>
Public Functions
-
struct FixedSizeListScalar : public arrow::BaseListScalar#
- #include <arrow/scalar.h>
Public Types
-
using TypeClass = FixedSizeListType#
Public Functions
-
using TypeClass = FixedSizeListType#
-
struct StructScalar : public arrow::Scalar#
- #include <arrow/scalar.h>
Public Members
-
ScalarVector value#
Public Static Functions
-
static Result<std::shared_ptr<StructScalar>> Make(ValueType value, std::vector<std::string> field_names)#
-
ScalarVector value#
-
struct UnionScalar : public arrow::Scalar, private arrow::internal::ArraySpanFillFromScalarScratchSpace#
- #include <arrow/scalar.h>
Subclassed by arrow::DenseUnionScalar, arrow::SparseUnionScalar
Public Members
-
int8_t type_code#
-
int8_t type_code#
-
struct SparseUnionScalar : public arrow::UnionScalar#
- #include <arrow/scalar.h>
Public Types
-
using TypeClass = SparseUnionType#
Public Static Functions
Construct a SparseUnionScalar from a single value, versus having to construct a vector of scalars.
-
using TypeClass = SparseUnionType#
-
struct DenseUnionScalar : public arrow::UnionScalar#
- #include <arrow/scalar.h>
-
struct RunEndEncodedScalar : public arrow::Scalar, private arrow::internal::ArraySpanFillFromScalarScratchSpace#
- #include <arrow/scalar.h>
-
struct DictionaryScalar : public arrow::internal::PrimitiveScalarBase#
- #include <arrow/scalar.h>
A Scalar value for DictionaryType.
is_valid
denotes the validity of theindex
, regardless of the corresponding value in thedictionary
.Public Types
-
using TypeClass = DictionaryType#
Public Functions
-
inline const void *data() const override#
-
inline void *mutable_data() override#
-
inline std::string_view view() const override#
Public Members
-
struct arrow::DictionaryScalar::ValueType value#
Public Static Functions
-
struct ValueType#
- #include <arrow/scalar.h>
-
using TypeClass = DictionaryType#
-
struct ExtensionScalar : public arrow::Scalar#
- #include <arrow/scalar.h>
A Scalar value for ExtensionType.
The value is the underlying storage scalar.
is_valid
must only be true ifvalue
is non-null andvalue->is_valid
is truePublic Functions
Utilities#
-
class ScalarVisitor#
Abstract scalar visitor class.
Subclass this to create a visitor that can be used with the Scalar::Accept() method.
Public Functions
-
virtual ~ScalarVisitor() = default#
-
virtual Status Visit(const NullScalar &scalar)#
-
virtual Status Visit(const BooleanScalar &scalar)#
-
virtual Status Visit(const Int8Scalar &scalar)#
-
virtual Status Visit(const Int16Scalar &scalar)#
-
virtual Status Visit(const Int32Scalar &scalar)#
-
virtual Status Visit(const Int64Scalar &scalar)#
-
virtual Status Visit(const UInt8Scalar &scalar)#
-
virtual Status Visit(const UInt16Scalar &scalar)#
-
virtual Status Visit(const UInt32Scalar &scalar)#
-
virtual Status Visit(const UInt64Scalar &scalar)#
-
virtual Status Visit(const HalfFloatScalar &scalar)#
-
virtual Status Visit(const FloatScalar &scalar)#
-
virtual Status Visit(const DoubleScalar &scalar)#
-
virtual Status Visit(const StringScalar &scalar)#
-
virtual Status Visit(const BinaryScalar &scalar)#
-
virtual Status Visit(const LargeStringScalar &scalar)#
-
virtual Status Visit(const LargeBinaryScalar &scalar)#
-
virtual Status Visit(const FixedSizeBinaryScalar &scalar)#
-
virtual Status Visit(const Date64Scalar &scalar)#
-
virtual Status Visit(const Date32Scalar &scalar)#
-
virtual Status Visit(const Time32Scalar &scalar)#
-
virtual Status Visit(const Time64Scalar &scalar)#
-
virtual Status Visit(const TimestampScalar &scalar)#
-
virtual Status Visit(const DayTimeIntervalScalar &scalar)#
-
virtual Status Visit(const MonthDayNanoIntervalScalar &type)#
-
virtual Status Visit(const MonthIntervalScalar &scalar)#
-
virtual Status Visit(const DurationScalar &scalar)#
-
virtual Status Visit(const Decimal128Scalar &scalar)#
-
virtual Status Visit(const Decimal256Scalar &scalar)#
-
virtual Status Visit(const ListScalar &scalar)#
-
virtual Status Visit(const LargeListScalar &scalar)#
-
virtual Status Visit(const FixedSizeListScalar &scalar)#
-
virtual Status Visit(const StructScalar &scalar)#
-
virtual Status Visit(const DictionaryScalar &scalar)#
-
virtual Status Visit(const SparseUnionScalar &scalar)#
-
virtual Status Visit(const DenseUnionScalar &scalar)#
-
virtual Status Visit(const RunEndEncodedScalar &scalar)#
-
virtual Status Visit(const ExtensionScalar &scalar)#
-
virtual ~ScalarVisitor() = default#