Utilities#

Decimal Numbers#

class BasicDecimal128 : public arrow::GenericBasicDecimal<BasicDecimal128, 128>#

Represents a signed 128-bit integer in two’s complement.

This class is also compiled into LLVM IR - so, it should not have cpp references like streams and boost.

Subclassed by arrow::Decimal128

Public Functions

inline constexpr BasicDecimal128(int64_t high, uint64_t low) noexcept#

Create a BasicDecimal128 from the two’s complement representation.

BasicDecimal128 &Negate()#

Negate the current value (in-place)

BasicDecimal128 &Abs()#

Absolute value (in-place)

BasicDecimal128 &operator+=(const BasicDecimal128 &right)#

Add a number to this one. The result is truncated to 128 bits.

BasicDecimal128 &operator-=(const BasicDecimal128 &right)#

Subtract a number from this one. The result is truncated to 128 bits.

BasicDecimal128 &operator*=(const BasicDecimal128 &right)#

Multiply this number by another number. The result is truncated to 128 bits.

DecimalStatus Divide(const BasicDecimal128 &divisor, BasicDecimal128 *result, BasicDecimal128 *remainder) const#

Divide this number by right and return the result.

This operation is not destructive. The answer rounds to zero. Signs work like: 21 / 5 -> 4, 1 -21 / 5 -> -4, -1 21 / -5 -> -4, 1 -21 / -5 -> 4, -1

Parameters:
  • divisor[in] the number to divide by

  • result[out] the quotient

  • remainder[out] the remainder after the division

BasicDecimal128 &operator/=(const BasicDecimal128 &right)#

In-place division.

BasicDecimal128 &operator|=(const BasicDecimal128 &right)#

Bitwise “or” between two BasicDecimal128.

BasicDecimal128 &operator&=(const BasicDecimal128 &right)#

Bitwise “and” between two BasicDecimal128.

BasicDecimal128 &operator<<=(uint32_t bits)#

Shift left by the given number of bits.

BasicDecimal128 &operator>>=(uint32_t bits)#

Shift right by the given number of bits.

Negative values will sign-extend.

inline constexpr int64_t high_bits() const#

Get the high bits of the two’s complement representation of the number.

inline constexpr uint64_t low_bits() const#

Get the low bits of the two’s complement representation of the number.

void GetWholeAndFraction(int32_t scale, BasicDecimal128 *whole, BasicDecimal128 *fraction) const#

separate the integer and fractional parts for the given scale.

DecimalStatus Rescale(int32_t original_scale, int32_t new_scale, BasicDecimal128 *out) const#

Convert BasicDecimal128 from one scale to another.

BasicDecimal128 IncreaseScaleBy(int32_t increase_by) const#

Scale up.

BasicDecimal128 ReduceScaleBy(int32_t reduce_by, bool round = true) const#

Scale down.

  • If ‘round’ is true, the right-most digits are dropped and the result value is rounded up (+1 for +ve, -1 for -ve) based on the value of the dropped digits (>= 10^reduce_by / 2).

  • If ‘round’ is false, the right-most digits are simply dropped.

bool FitsInPrecision(int32_t precision) const#

Whether this number fits in the given precision.

Return true if the number of significant digits is less or equal to precision.

int32_t CountLeadingBinaryZeros() const#

count the number of leading binary zeroes.

inline constexpr GenericBasicDecimal() noexcept#

Empty constructor creates a decimal with a value of 0.

inline explicit constexpr GenericBasicDecimal(const WordArray &array) noexcept#

Create a decimal from the two’s complement representation.

Input array is assumed to be in native endianness.

inline GenericBasicDecimal(LittleEndianArrayTag, const WordArray &array) noexcept#

Create a decimal from the two’s complement representation.

Input array is assumed to be in little endianness, with native endian elements.

template<typename T, typename = typename std::enable_if<std::is_integral<T>::value && (sizeof(T) <= sizeof(uint64_t)), T>::type>
inline constexpr GenericBasicDecimal(T value) noexcept#

Create a decimal from any integer not wider than 64 bits.

inline explicit GenericBasicDecimal(const uint8_t *bytes)#

Create a decimal from an array of bytes.

Bytes are assumed to be in native-endian byte order.

Public Static Functions

static BasicDecimal128 Abs(const BasicDecimal128 &left)#

Absolute value.

static const BasicDecimal128 &GetScaleMultiplier(int32_t scale)#

Scale multiplier for given scale value.

static const BasicDecimal128 &GetHalfScaleMultiplier(int32_t scale)#

Half-scale multiplier for given scale value.

static const BasicDecimal128 &GetMaxValue()#

Get the maximum valid unscaled decimal value.

static BasicDecimal128 GetMaxValue(int32_t precision)#

Get the maximum valid unscaled decimal value for the given precision.

static inline constexpr BasicDecimal128 GetMaxSentinel()#

Get the maximum decimal value (is not a valid value).

static inline constexpr BasicDecimal128 GetMinSentinel()#

Get the minimum decimal value (is not a valid value).

class Decimal128 : public arrow::BasicDecimal128#

Represents a signed 128-bit integer in two’s complement.

Calculations wrap around and overflow is ignored. The max decimal precision that can be safely represented is 38 significant digits.

For a discussion of the algorithms, look at Knuth’s volume 2, Semi-numerical Algorithms section 4.3.1.

Adapted from the Apache ORC C++ implementation

The implementation is split into two parts :

  1. BasicDecimal128

    • can be safely compiled to IR without references to libstdc++.

  2. Decimal128

    • has additional functionality on top of BasicDecimal128 to deal with strings and streams.

Public Functions

inline constexpr Decimal128(const BasicDecimal128 &value) noexcept#

constructor creates a Decimal128 from a BasicDecimal128.

explicit Decimal128(const std::string &value)#

Parse the number from a base 10 string representation.

inline constexpr Decimal128() noexcept#

Empty constructor creates a Decimal128 with a value of 0.

inline Result<std::pair<Decimal128, Decimal128>> Divide(const Decimal128 &divisor) const#

Divide this number by right and return the result.

This operation is not destructive. The answer rounds to zero. Signs work like: 21 / 5 -> 4, 1 -21 / 5 -> -4, -1 21 / -5 -> -4, 1 -21 / -5 -> 4, -1

Parameters:

divisor[in] the number to divide by

Returns:

the pair of the quotient and the remainder

std::string ToString(int32_t scale) const#

Convert the Decimal128 value to a base 10 decimal string with the given scale.

std::string ToIntegerString() const#

Convert the value to an integer string.

explicit operator int64_t() const#

Cast this value to an int64_t.

inline Result<Decimal128> Rescale(int32_t original_scale, int32_t new_scale) const#

Convert Decimal128 from one scale to another.

template<typename T, typename = internal::EnableIfIsOneOf<T, int32_t, int64_t>>
inline Result<T> ToInteger() const#

Convert to a signed integer.

template<typename T, typename = internal::EnableIfIsOneOf<T, int32_t, int64_t>>
inline Status ToInteger(T *out) const#

Convert to a signed integer.

float ToFloat(int32_t scale) const#

Convert to a floating-point number (scaled)

double ToDouble(int32_t scale) const#

Convert to a floating-point number (scaled)

template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
inline T ToReal(int32_t scale) const#

Convert to a floating-point number (scaled)

Public Static Functions

static Status FromString(std::string_view s, Decimal128 *out, int32_t *precision, int32_t *scale = NULLPTR)#

Convert a decimal string to a Decimal128 value, optionally including precision and scale if they’re passed in and not null.

static Result<Decimal128> FromBigEndian(const uint8_t *data, int32_t length)#

Convert from a big-endian byte representation.

The length must be between 1 and 16.

Returns:

error status if the length is an invalid value

class BasicDecimal256 : public arrow::GenericBasicDecimal<BasicDecimal256, 256>#

Subclassed by arrow::Decimal256

Public Functions

BasicDecimal256 &Negate()#

Negate the current value (in-place)

BasicDecimal256 &Abs()#

Absolute value (in-place)

BasicDecimal256 &operator+=(const BasicDecimal256 &right)#

Add a number to this one. The result is truncated to 256 bits.

BasicDecimal256 &operator-=(const BasicDecimal256 &right)#

Subtract a number from this one. The result is truncated to 256 bits.

inline uint64_t low_bits() const#

Get the lowest bits of the two’s complement representation of the number.

void GetWholeAndFraction(int32_t scale, BasicDecimal256 *whole, BasicDecimal256 *fraction) const#

separate the integer and fractional parts for the given scale.

DecimalStatus Rescale(int32_t original_scale, int32_t new_scale, BasicDecimal256 *out) const#

Convert BasicDecimal256 from one scale to another.

BasicDecimal256 IncreaseScaleBy(int32_t increase_by) const#

Scale up.

BasicDecimal256 ReduceScaleBy(int32_t reduce_by, bool round = true) const#

Scale down.

  • If ‘round’ is true, the right-most digits are dropped and the result value is rounded up (+1 for positive, -1 for negative) based on the value of the dropped digits (>= 10^reduce_by / 2).

  • If ‘round’ is false, the right-most digits are simply dropped.

bool FitsInPrecision(int32_t precision) const#

Whether this number fits in the given precision.

Return true if the number of significant digits is less or equal to precision.

BasicDecimal256 &operator*=(const BasicDecimal256 &right)#

Multiply this number by another number. The result is truncated to 256 bits.

DecimalStatus Divide(const BasicDecimal256 &divisor, BasicDecimal256 *result, BasicDecimal256 *remainder) const#

Divide this number by right and return the result.

This operation is not destructive. The answer rounds to zero. Signs work like: 21 / 5 -> 4, 1 -21 / 5 -> -4, -1 21 / -5 -> -4, 1 -21 / -5 -> 4, -1

Parameters:
  • divisor[in] the number to divide by

  • result[out] the quotient

  • remainder[out] the remainder after the division

BasicDecimal256 &operator<<=(uint32_t bits)#

Shift left by the given number of bits.

BasicDecimal256 &operator>>=(uint32_t bits)#

Shift right by the given number of bits.

Negative values will sign-extend.

BasicDecimal256 &operator/=(const BasicDecimal256 &right)#

In-place division.

inline constexpr GenericBasicDecimal() noexcept#

Empty constructor creates a decimal with a value of 0.

inline explicit constexpr GenericBasicDecimal(const WordArray &array) noexcept#

Create a decimal from the two’s complement representation.

Input array is assumed to be in native endianness.

inline GenericBasicDecimal(LittleEndianArrayTag, const WordArray &array) noexcept#

Create a decimal from the two’s complement representation.

Input array is assumed to be in little endianness, with native endian elements.

template<typename T, typename = typename std::enable_if<std::is_integral<T>::value && (sizeof(T) <= sizeof(uint64_t)), T>::type>
inline constexpr GenericBasicDecimal(T value) noexcept#

Create a decimal from any integer not wider than 64 bits.

inline explicit GenericBasicDecimal(const uint8_t *bytes)#

Create a decimal from an array of bytes.

Bytes are assumed to be in native-endian byte order.

Public Static Functions

static BasicDecimal256 Abs(const BasicDecimal256 &left)#

Absolute value.

static const BasicDecimal256 &GetScaleMultiplier(int32_t scale)#

Scale multiplier for given scale value.

static const BasicDecimal256 &GetHalfScaleMultiplier(int32_t scale)#

Half-scale multiplier for given scale value.

static BasicDecimal256 GetMaxValue(int32_t precision)#

Get the maximum valid unscaled decimal value for the given precision.

static inline constexpr BasicDecimal256 GetMaxSentinel()#

Get the maximum decimal value (is not a valid value).

static inline constexpr BasicDecimal256 GetMinSentinel()#

Get the minimum decimal value (is not a valid value).

class Decimal256 : public arrow::BasicDecimal256#

Represents a signed 256-bit integer in two’s complement.

The max decimal precision that can be safely represented is 76 significant digits.

The implementation is split into two parts :

  1. BasicDecimal256

    • can be safely compiled to IR without references to libstdc++.

  2. Decimal256

    • (TODO) has additional functionality on top of BasicDecimal256 to deal with strings and streams.

Public Functions

inline constexpr Decimal256(const BasicDecimal256 &value) noexcept#

constructor creates a Decimal256 from a BasicDecimal256.

explicit Decimal256(const std::string &value)#

Parse the number from a base 10 string representation.

inline constexpr Decimal256() noexcept#

Empty constructor creates a Decimal256 with a value of 0.

std::string ToString(int32_t scale) const#

Convert the Decimal256 value to a base 10 decimal string with the given scale.

std::string ToIntegerString() const#

Convert the value to an integer string.

inline Result<Decimal256> Rescale(int32_t original_scale, int32_t new_scale) const#

Convert Decimal256 from one scale to another.

inline Result<std::pair<Decimal256, Decimal256>> Divide(const Decimal256 &divisor) const#

Divide this number by right and return the result.

This operation is not destructive. The answer rounds to zero. Signs work like: 21 / 5 -> 4, 1 -21 / 5 -> -4, -1 21 / -5 -> -4, 1 -21 / -5 -> 4, -1

Parameters:

divisor[in] the number to divide by

Returns:

the pair of the quotient and the remainder

float ToFloat(int32_t scale) const#

Convert to a floating-point number (scaled).

May return infinity in case of overflow.

double ToDouble(int32_t scale) const#

Convert to a floating-point number (scaled)

template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
inline T ToReal(int32_t scale) const#

Convert to a floating-point number (scaled)

Public Static Functions

static Status FromString(std::string_view s, Decimal256 *out, int32_t *precision, int32_t *scale = NULLPTR)#

Convert a decimal string to a Decimal256 value, optionally including precision and scale if they’re passed in and not null.

static Result<Decimal256> FromBigEndian(const uint8_t *data, int32_t length)#

Convert from a big-endian byte representation.

The length must be between 1 and 32.

Returns:

error status if the length is an invalid value

Iterators#

template<typename T>
class Iterator : public arrow::util::EqualityComparable<Iterator<T>>#

A generic Iterator that can return errors.

Public Functions

template<typename Wrapped>
inline explicit Iterator(Wrapped has_next)#

Iterator may be constructed from any type which has a member function with signature Result<T> Next(); End of iterator is signalled by returning IteratorTraits<T>::End();.

The argument is moved or copied to the heap and kept in a unique_ptr<void>. Only its destructor and its Next method (which are stored in function pointers) are referenced after construction.

This approach is used to dodge MSVC linkage hell (ARROW-6244, ARROW-6558) when using an abstract template base class: instead of being inlined as usual for a template function the base’s virtual destructor will be exported, leading to multiple definition errors when linking to any other TU where the base is instantiated.

inline Result<T> Next()#

Return the next element of the sequence, IterationTraits<T>::End() when the iteration is completed.

Calling this on a default constructed Iterator will result in undefined behavior.

template<typename Visitor>
inline Status Visit(Visitor &&visitor)#

Pass each element of the sequence to a visitor.

Will return any error status returned by the visitor, terminating iteration.

inline bool Equals(const Iterator &other) const#

Iterators will only compare equal if they are both null.

Equality comparability is required to make an Iterator of Iterators (to check for the end condition).

inline Result<std::vector<T>> ToVector()#

Move every element of this iterator into a vector.

class RangeIterator#
template<typename T>
class VectorIterator#

Simple iterator which yields the elements of a std::vector.

Compression#

enum arrow::Compression::type#

Compression algorithm.

Values:

enumerator UNCOMPRESSED#
enumerator SNAPPY#
enumerator GZIP#
enumerator BROTLI#
enumerator ZSTD#
enumerator LZ4#
enumerator LZ4_FRAME#
enumerator LZO#
enumerator BZ2#
enumerator LZ4_HADOOP#
class Codec#

Compression codec.

Public Functions

virtual int minimum_compression_level() const = 0#

Return the smallest supported compression level.

virtual int maximum_compression_level() const = 0#

Return the largest supported compression level.

virtual int default_compression_level() const = 0#

Return the default compression level.

virtual Result<int64_t> Decompress(int64_t input_len, const uint8_t *input, int64_t output_buffer_len, uint8_t *output_buffer) = 0#

One-shot decompression function.

output_buffer_len must be correct and therefore be obtained in advance. The actual decompressed length is returned.

Note

One-shot decompression is not always compatible with streaming compression. Depending on the codec (e.g. LZ4), different formats may be used.

virtual Result<int64_t> Compress(int64_t input_len, const uint8_t *input, int64_t output_buffer_len, uint8_t *output_buffer) = 0#

One-shot compression function.

output_buffer_len must first have been computed using MaxCompressedLen(). The actual compressed length is returned.

Note

One-shot compression is not always compatible with streaming decompression. Depending on the codec (e.g. LZ4), different formats may be used.

virtual Result<std::shared_ptr<Compressor>> MakeCompressor() = 0#

Create a streaming compressor instance.

virtual Result<std::shared_ptr<Decompressor>> MakeDecompressor() = 0#

Create a streaming compressor instance.

virtual Compression::type compression_type() const = 0#

This Codec’s compression type.

inline const std::string &name() const#

The name of this Codec’s compression type.

inline virtual int compression_level() const#

This Codec’s compression level, if applicable.

Public Static Functions

static int UseDefaultCompressionLevel()#

Return special value to indicate that a codec implementation should use its default compression level.

static const std::string &GetCodecAsString(Compression::type t)#

Return a string name for compression type.

static Result<Compression::type> GetCompressionType(const std::string &name)#

Return compression type for name (all lower case)

static Result<std::unique_ptr<Codec>> Create(Compression::type codec, const CodecOptions &codec_options = CodecOptions{})#

Create a codec for the given compression algorithm with CodecOptions.

static Result<std::unique_ptr<Codec>> Create(Compression::type codec, int compression_level)#

Create a codec for the given compression algorithm.

static bool IsAvailable(Compression::type codec)#

Return true if support for indicated codec has been enabled.

static bool SupportsCompressionLevel(Compression::type codec)#

Return true if indicated codec supports setting a compression level.

static Result<int> MinimumCompressionLevel(Compression::type codec)#

Return the smallest supported compression level for the codec Note: This function creates a temporary Codec instance.

static Result<int> MaximumCompressionLevel(Compression::type codec)#

Return the largest supported compression level for the codec Note: This function creates a temporary Codec instance.

static Result<int> DefaultCompressionLevel(Compression::type codec)#

Return the default compression level Note: This function creates a temporary Codec instance.

class Compressor#

Streaming compressor interface.

Public Functions

virtual Result<CompressResult> Compress(int64_t input_len, const uint8_t *input, int64_t output_len, uint8_t *output) = 0#

Compress some input.

If bytes_read is 0 on return, then a larger output buffer should be supplied.

virtual Result<FlushResult> Flush(int64_t output_len, uint8_t *output) = 0#

Flush part of the compressed output.

If should_retry is true on return, Flush() should be called again with a larger buffer.

virtual Result<EndResult> End(int64_t output_len, uint8_t *output) = 0#

End compressing, doing whatever is necessary to end the stream.

If should_retry is true on return, End() should be called again with a larger buffer. Otherwise, the Compressor should not be used anymore.

End() implies Flush().

struct CompressResult#
struct EndResult#
struct FlushResult#
class Decompressor#

Streaming decompressor interface.

Public Functions

virtual Result<DecompressResult> Decompress(int64_t input_len, const uint8_t *input, int64_t output_len, uint8_t *output) = 0#

Decompress some input.

If need_more_output is true on return, a larger output buffer needs to be supplied.

virtual bool IsFinished() = 0#

Return whether the compressed stream is finished.

This is a heuristic. If true is returned, then it is guaranteed that the stream is finished. If false is returned, however, it may simply be that the underlying library isn’t able to provide the information.

virtual Status Reset() = 0#

Reinitialize decompressor, making it ready for a new compressed stream.

struct DecompressResult#

Visitors#

template<typename VISITOR, typename ...ARGS>
inline Status arrow::VisitTypeInline(const DataType &type, VISITOR *visitor, ARGS&&... args)#

Calls visitor with the corresponding concrete type class.

A visitor is a type that implements specialized logic for each Arrow type. Example usage:

class ExampleVisitor {
  arrow::Status Visit(const arrow::Int32Type& type) { ... }
  arrow::Status Visit(const arrow::Int64Type& type) { ... }
  ...
}
ExampleVisitor visitor;
VisitTypeInline(some_type, &visitor);
Template Parameters:
  • VISITOR – Visitor type that implements Visit() for all Arrow types.

  • ARGS – Additional arguments, if any, will be passed to the Visit function after the type argument

Returns:

Status

template<typename VISITOR, typename ...ARGS>
inline Status arrow::VisitTypeIdInline(Type::type id, VISITOR *visitor, ARGS&&... args)#

Calls visitor with a nullptr of the corresponding concrete type class.

Template Parameters:
  • VISITOR – Visitor type that implements Visit() for all Arrow types.

  • ARGS – Additional arguments, if any, will be passed to the Visit function after the type argument

Returns:

Status

template<typename VISITOR, typename ...ARGS>
inline Status arrow::VisitScalarInline(const Scalar &scalar, VISITOR *visitor, ARGS&&... args)#

Apply the visitors Visit() method specialized to the scalar type.

A visitor is a type that implements specialized logic for each Arrow type. Example usage:

class ExampleVisitor {
  arrow::Status Visit(arrow::Int32Scalar scalar) { ... }
  arrow::Status Visit(arrow::Int64Scalar scalar) { ... }
  ...
}
ExampleVisitor visitor;
VisitScalarInline(some_scalar, &visitor);
Template Parameters:
  • VISITOR – Visitor type that implements Visit() for all scalar types.

  • ARGS – Additional arguments, if any, will be passed to the Visit function after the scalar argument

Returns:

Status

template<typename VISITOR, typename ...ARGS>
inline Status arrow::VisitArrayInline(const Array &array, VISITOR *visitor, ARGS&&... args)#

Apply the visitors Visit() method specialized to the array type.

A visitor is a type that implements specialized logic for each Arrow type. Example usage:

class ExampleVisitor {
  arrow::Status Visit(arrow::NumericArray<Int32Type> arr) { ... }
  arrow::Status Visit(arrow::NumericArray<Int64Type> arr) { ... }
  ...
}
ExampleVisitor visitor;
VisitArrayInline(some_array, &visitor);
Template Parameters:
  • VISITOR – Visitor type that implements Visit() for all array types.

  • ARGS – Additional arguments, if any, will be passed to the Visit function after the arr argument

Returns:

Status

Type Traits#

These types provide relationships between Arrow types at compile time. TypeTraits maps Arrow DataTypes to other types, and CTypeTraits maps C types to Arrow types.

TypeTraits#

Each specialized type defines the following associated types:

type TypeTraits::ArrayType#

Corresponding Arrow array type

type TypeTraits::BuilderType#

Corresponding array builder type

type TypeTraits::ScalarType#

Corresponding Arrow scalar type

bool TypeTraits::is_parameter_free#

Whether the type has any type parameters, such as field types in nested types or scale and precision in decimal types.

In addition, the following are defined for many but not all of the types:

type TypeTraits::CType#

Corresponding C type. For example, int64_t for Int64Array.

type TypeTraits::TensorType#

Corresponding Arrow tensor type

static inline constexpr int64_t bytes_required(int64_t elements)#

Return the number of bytes required for given number of elements. Defined for types with a fixed size.

static inline std::shared_ptr<DataType> TypeTraits::type_singleton()#

For types where is_parameter_free is true, returns an instance of the data type.

template<>
struct TypeTraits<NullType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = NullArray#
using BuilderType = NullBuilder#
using ScalarType = NullScalar#

Public Static Functions

static inline constexpr int64_t bytes_required(int64_t)#
static inline std::shared_ptr<DataType> type_singleton()#

Public Static Attributes

static constexpr bool is_parameter_free = true#
template<>
struct TypeTraits<BooleanType>#
#include <arrow/type_traits.h>

Subclassed by arrow::CTypeTraits< bool >

Public Types

using ArrayType = BooleanArray#
using BuilderType = BooleanBuilder#
using ScalarType = BooleanScalar#
using CType = bool#

Public Static Functions

static inline constexpr int64_t bytes_required(int64_t elements)#
static inline std::shared_ptr<DataType> type_singleton()#

Public Static Attributes

static constexpr bool is_parameter_free = true#
template<>
struct TypeTraits<Date64Type>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = Date64Array#
using BuilderType = Date64Builder#
using ScalarType = Date64Scalar#
using CType = Date64Type::c_type#

Public Static Functions

static inline constexpr int64_t bytes_required(int64_t elements)#
static inline std::shared_ptr<DataType> type_singleton()#

Public Static Attributes

static constexpr bool is_parameter_free = true#
template<>
struct TypeTraits<Date32Type>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = Date32Array#
using BuilderType = Date32Builder#
using ScalarType = Date32Scalar#
using CType = Date32Type::c_type#

Public Static Functions

static inline constexpr int64_t bytes_required(int64_t elements)#
static inline std::shared_ptr<DataType> type_singleton()#

Public Static Attributes

static constexpr bool is_parameter_free = true#
template<>
struct TypeTraits<TimestampType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = TimestampArray#
using BuilderType = TimestampBuilder#
using ScalarType = TimestampScalar#
using CType = TimestampType::c_type#

Public Static Functions

static inline constexpr int64_t bytes_required(int64_t elements)#

Public Static Attributes

static constexpr bool is_parameter_free = false#
template<>
struct TypeTraits<DurationType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = DurationArray#
using BuilderType = DurationBuilder#
using ScalarType = DurationScalar#
using CType = DurationType::c_type#

Public Static Functions

static inline constexpr int64_t bytes_required(int64_t elements)#

Public Static Attributes

static constexpr bool is_parameter_free = false#
template<>
struct TypeTraits<DayTimeIntervalType>#
#include <arrow/type_traits.h>

Subclassed by arrow::CTypeTraits< DayTimeIntervalType::DayMilliseconds >

Public Types

using ArrayType = DayTimeIntervalArray#
using BuilderType = DayTimeIntervalBuilder#
using ScalarType = DayTimeIntervalScalar#
using CType = DayTimeIntervalType::c_type#

Public Static Functions

static inline constexpr int64_t bytes_required(int64_t elements)#
static inline std::shared_ptr<DataType> type_singleton()#

Public Static Attributes

static constexpr bool is_parameter_free = true#
template<>
struct TypeTraits<MonthDayNanoIntervalType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = MonthDayNanoIntervalArray#
using BuilderType = MonthDayNanoIntervalBuilder#
using ScalarType = MonthDayNanoIntervalScalar#
using CType = MonthDayNanoIntervalType::c_type#

Public Static Functions

static inline constexpr int64_t bytes_required(int64_t elements)#
static inline std::shared_ptr<DataType> type_singleton()#

Public Static Attributes

static constexpr bool is_parameter_free = true#
template<>
struct TypeTraits<MonthIntervalType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = MonthIntervalArray#
using BuilderType = MonthIntervalBuilder#
using ScalarType = MonthIntervalScalar#
using CType = MonthIntervalType::c_type#

Public Static Functions

static inline constexpr int64_t bytes_required(int64_t elements)#
static inline std::shared_ptr<DataType> type_singleton()#

Public Static Attributes

static constexpr bool is_parameter_free = true#
template<>
struct TypeTraits<Time32Type>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = Time32Array#
using BuilderType = Time32Builder#
using ScalarType = Time32Scalar#
using CType = Time32Type::c_type#

Public Static Functions

static inline constexpr int64_t bytes_required(int64_t elements)#

Public Static Attributes

static constexpr bool is_parameter_free = false#
template<>
struct TypeTraits<Time64Type>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = Time64Array#
using BuilderType = Time64Builder#
using ScalarType = Time64Scalar#
using CType = Time64Type::c_type#

Public Static Functions

static inline constexpr int64_t bytes_required(int64_t elements)#

Public Static Attributes

static constexpr bool is_parameter_free = false#
template<>
struct TypeTraits<HalfFloatType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = HalfFloatArray#
using BuilderType = HalfFloatBuilder#
using ScalarType = HalfFloatScalar#
using TensorType = HalfFloatTensor#

Public Static Functions

static inline constexpr int64_t bytes_required(int64_t elements)#
static inline std::shared_ptr<DataType> type_singleton()#

Public Static Attributes

static constexpr bool is_parameter_free = true#
template<>
struct TypeTraits<Decimal128Type>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = Decimal128Array#
using BuilderType = Decimal128Builder#
using ScalarType = Decimal128Scalar#
using CType = Decimal128#

Public Static Attributes

static constexpr bool is_parameter_free = false#
template<>
struct TypeTraits<Decimal256Type>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = Decimal256Array#
using BuilderType = Decimal256Builder#
using ScalarType = Decimal256Scalar#
using CType = Decimal256#

Public Static Attributes

static constexpr bool is_parameter_free = false#
template<>
struct TypeTraits<BinaryType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = BinaryArray#
using BuilderType = BinaryBuilder#
using ScalarType = BinaryScalar#
using OffsetType = Int32Type#

Public Static Functions

static inline std::shared_ptr<DataType> type_singleton()#

Public Static Attributes

static constexpr bool is_parameter_free = true#
template<>
struct TypeTraits<BinaryViewType>#
#include <arrow/type_traits.h>

Subclassed by arrow::CTypeTraits< BinaryViewType::c_type >

Public Types

using ArrayType = BinaryViewArray#
using BuilderType = BinaryViewBuilder#
using ScalarType = BinaryViewScalar#
using CType = BinaryViewType::c_type#

Public Static Functions

static inline std::shared_ptr<DataType> type_singleton()#

Public Static Attributes

static constexpr bool is_parameter_free = true#
template<>
struct TypeTraits<LargeBinaryType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = LargeBinaryArray#
using BuilderType = LargeBinaryBuilder#
using ScalarType = LargeBinaryScalar#
using OffsetType = Int64Type#

Public Static Functions

static inline std::shared_ptr<DataType> type_singleton()#

Public Static Attributes

static constexpr bool is_parameter_free = true#
template<>
struct TypeTraits<FixedSizeBinaryType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = FixedSizeBinaryArray#
using BuilderType = FixedSizeBinaryBuilder#
using ScalarType = FixedSizeBinaryScalar#
using OffsetType = Int32Type#

Public Static Attributes

static constexpr bool is_parameter_free = false#
template<>
struct TypeTraits<StringType>#
#include <arrow/type_traits.h>

Subclassed by arrow::CTypeTraits< std::string >

Public Types

using ArrayType = StringArray#
using BuilderType = StringBuilder#
using ScalarType = StringScalar#
using OffsetType = Int32Type#

Public Static Functions

static inline std::shared_ptr<DataType> type_singleton()#

Public Static Attributes

static constexpr bool is_parameter_free = true#
template<>
struct TypeTraits<StringViewType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = StringViewArray#
using BuilderType = StringViewBuilder#
using ScalarType = StringViewScalar#
using CType = BinaryViewType::c_type#

Public Static Functions

static inline std::shared_ptr<DataType> type_singleton()#

Public Static Attributes

static constexpr bool is_parameter_free = true#
template<>
struct TypeTraits<LargeStringType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = LargeStringArray#
using BuilderType = LargeStringBuilder#
using ScalarType = LargeStringScalar#
using OffsetType = Int64Type#

Public Static Functions

static inline std::shared_ptr<DataType> type_singleton()#

Public Static Attributes

static constexpr bool is_parameter_free = true#
template<>
struct TypeTraits<RunEndEncodedType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = RunEndEncodedArray#
using BuilderType = RunEndEncodedBuilder#
using ScalarType = RunEndEncodedScalar#

Public Static Attributes

static constexpr bool is_parameter_free = false#
template<>
struct TypeTraits<ListType>#
#include <arrow/type_traits.h>

Subclassed by arrow::CTypeTraits< std::vector< CType > >

Public Types

using ArrayType = ListArray#
using BuilderType = ListBuilder#
using ScalarType = ListScalar#
using OffsetType = Int32Type#
using OffsetArrayType = Int32Array#
using OffsetBuilderType = Int32Builder#
using OffsetScalarType = Int32Scalar#
using LargeType = LargeListType#

Public Static Attributes

static constexpr bool is_parameter_free = false#
template<>
struct TypeTraits<LargeListType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = LargeListArray#
using BuilderType = LargeListBuilder#
using ScalarType = LargeListScalar#
using OffsetType = Int64Type#
using OffsetArrayType = Int64Array#
using OffsetBuilderType = Int64Builder#
using OffsetScalarType = Int64Scalar#

Public Static Attributes

static constexpr bool is_parameter_free = false#
template<>
struct TypeTraits<ListViewType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = ListViewArray#
using BuilderType = ListViewBuilder#
using ScalarType = ListViewScalar#
using OffsetType = Int32Type#
using OffsetArrayType = Int32Array#
using OffsetBuilderType = Int32Builder#
using OffsetScalarType = Int32Scalar#
using LargeType = LargeListViewType#

Public Static Attributes

static constexpr bool is_parameter_free = false#
template<>
struct TypeTraits<LargeListViewType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = LargeListViewArray#
using BuilderType = LargeListViewBuilder#
using ScalarType = LargeListViewScalar#
using OffsetType = Int64Type#
using OffsetArrayType = Int64Array#
using OffsetBuilderType = Int64Builder#
using OffsetScalarType = Int64Scalar#

Public Static Attributes

static constexpr bool is_parameter_free = false#
template<>
struct TypeTraits<MapType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = MapArray#
using BuilderType = MapBuilder#
using ScalarType = MapScalar#
using OffsetType = Int32Type#
using OffsetArrayType = Int32Array#
using OffsetBuilderType = Int32Builder#

Public Static Attributes

static constexpr bool is_parameter_free = false#
template<>
struct TypeTraits<FixedSizeListType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = FixedSizeListArray#
using BuilderType = FixedSizeListBuilder#
using ScalarType = FixedSizeListScalar#

Public Static Attributes

static constexpr bool is_parameter_free = false#
template<>
struct TypeTraits<StructType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = StructArray#
using BuilderType = StructBuilder#
using ScalarType = StructScalar#

Public Static Attributes

static constexpr bool is_parameter_free = false#
template<>
struct TypeTraits<SparseUnionType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = SparseUnionArray#
using BuilderType = SparseUnionBuilder#
using ScalarType = SparseUnionScalar#

Public Static Attributes

static constexpr bool is_parameter_free = false#
template<>
struct TypeTraits<DenseUnionType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = DenseUnionArray#
using BuilderType = DenseUnionBuilder#
using ScalarType = DenseUnionScalar#

Public Static Attributes

static constexpr bool is_parameter_free = false#
template<>
struct TypeTraits<DictionaryType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = DictionaryArray#
using ScalarType = DictionaryScalar#

Public Static Attributes

static constexpr bool is_parameter_free = false#
template<>
struct TypeTraits<ExtensionType>#
#include <arrow/type_traits.h>

Public Types

using ArrayType = ExtensionArray#
using ScalarType = ExtensionScalar#

Public Static Attributes

static constexpr bool is_parameter_free = false#

CTypeTraits#

Each specialized type defines the following associated types:

type CTypeTraits::ArrowType#

Corresponding Arrow type

template<>
struct CTypeTraits<std::string> : public arrow::TypeTraits<StringType>#
#include <arrow/type_traits.h>

Subclassed by arrow::CTypeTraits< const char * >, arrow::CTypeTraits< const char(&)[N]>, arrow::stl::ConversionTraits< std::string >

Public Types

using ArrowType = StringType#
template<>
struct CTypeTraits<BinaryViewType::c_type> : public arrow::TypeTraits<BinaryViewType>#
#include <arrow/type_traits.h>

Public Types

using ArrowType = BinaryViewType#
template<>
struct CTypeTraits<const char*> : public arrow::CTypeTraits<std::string>#
#include <arrow/type_traits.h>
template<size_t N>
struct CTypeTraits<const char (&)[N]> : public arrow::CTypeTraits<std::string>#
#include <arrow/type_traits.h>
template<>
struct CTypeTraits<DayTimeIntervalType::DayMilliseconds> : public arrow::TypeTraits<DayTimeIntervalType>#
#include <arrow/type_traits.h>

Public Types

using ArrowType = DayTimeIntervalType#

Type Predicates#

Type predicates that can be used with templates. Predicates of the form is_XXX resolve to constant boolean values, while predicates of the form enable_if_XXX resolve to the second type parameter R if the first parameter T passes the test.

Example usage:

template<typename TypeClass>
arrow::enable_if_number<TypeClass, RETURN_TYPE> MyFunction(const TypeClass& type) {
  ..
}

template<typename ArrayType, typename TypeClass=ArrayType::TypeClass>
arrow::enable_if_number<TypeClass, RETURN_TYPE> MyFunction(const ArrayType& array) {
  ..
}
template<bool B, typename T = void>
using enable_if_t = typename std::enable_if<B, T>::type#
template<typename T>
using is_null_type = std::is_same<NullType, T>#
template<typename T, typename R = void>
using enable_if_null = enable_if_t<is_null_type<T>::value, R>#
template<typename T>
using is_boolean_type = std::is_same<BooleanType, T>#
template<typename T, typename R = void>
using enable_if_boolean = enable_if_t<is_boolean_type<T>::value, R>#
template<typename T>
using is_number_type = std::is_base_of<NumberType, T>#
template<typename T, typename R = void>
using enable_if_number = enable_if_t<is_number_type<T>::value, R>#
template<typename T>
using is_integer_type = std::is_base_of<IntegerType, T>#
template<typename T, typename R = void>
using enable_if_integer = enable_if_t<is_integer_type<T>::value, R>#
template<typename T>
using is_signed_integer_type = std::integral_constant<bool, is_integer_type<T>::value && std::is_signed<typename T::c_type>::value>#
template<typename T, typename R = void>
using enable_if_signed_integer = enable_if_t<is_signed_integer_type<T>::value, R>#
template<typename T>
using is_unsigned_integer_type = std::integral_constant<bool, is_integer_type<T>::value && std::is_unsigned<typename T::c_type>::value>#
template<typename T, typename R = void>
using enable_if_unsigned_integer = enable_if_t<is_unsigned_integer_type<T>::value, R>#
template<typename T>
using is_floating_type = std::is_base_of<FloatingPointType, T>#
template<typename T, typename R = void>
using enable_if_floating_point = enable_if_t<is_floating_type<T>::value, R>#
template<typename T>
using is_half_float_type = std::is_same<HalfFloatType, T>#
template<typename T, typename R = void>
using enable_if_half_float = enable_if_t<is_half_float_type<T>::value, R>#
template<typename T>
using is_base_binary_type = std::is_base_of<BaseBinaryType, T>#
template<typename T, typename R = void>
using enable_if_base_binary = enable_if_t<is_base_binary_type<T>::value, R>#
template<typename T>
using is_binary_type = std::integral_constant<bool, std::is_same<BinaryType, T>::value || std::is_same<LargeBinaryType, T>::value>#
template<typename T, typename R = void>
using enable_if_binary = enable_if_t<is_binary_type<T>::value, R>#
template<typename T>
using is_string_type = std::integral_constant<bool, std::is_same<StringType, T>::value || std::is_same<LargeStringType, T>::value>#
template<typename T, typename R = void>
using enable_if_string = enable_if_t<is_string_type<T>::value, R>#
template<typename T>
using is_binary_view_like_type = std::is_base_of<BinaryViewType, T>#
template<typename T>
using is_binary_view_type = std::is_same<BinaryViewType, T>#
template<typename T>
using is_string_view_type = std::is_same<StringViewType, T>#
template<typename T, typename R = void>
using enable_if_binary_view_like = enable_if_t<is_binary_view_like_type<T>::value, R>#
template<typename T, typename R = void>
using enable_if_binary_view = enable_if_t<is_binary_view_type<T>::value, R>#
template<typename T, typename R = void>
using enable_if_string_view = enable_if_t<is_string_view_type<T>::value, R>#
template<typename T>
using is_string_like_type = std::integral_constant<bool, is_base_binary_type<T>::value && T::is_utf8>#
template<typename T, typename R = void>
using enable_if_string_like = enable_if_t<is_string_like_type<T>::value, R>#
template<typename T, typename U, typename R = void>
using enable_if_same = enable_if_t<std::is_same<T, U>::value, R>#
template<typename T>
using is_fixed_size_binary_type = std::is_base_of<FixedSizeBinaryType, T>#
template<typename T, typename R = void>
using enable_if_fixed_size_binary = enable_if_t<is_fixed_size_binary_type<T>::value, R>#
template<typename T>
using is_fixed_width_type = std::is_base_of<FixedWidthType, T>#
template<typename T, typename R = void>
using enable_if_fixed_width_type = enable_if_t<is_fixed_width_type<T>::value, R>#
template<typename T>
using is_binary_like_type = std::integral_constant<bool, (is_base_binary_type<T>::value && !is_string_like_type<T>::value) || is_fixed_size_binary_type<T>::value>#
template<typename T, typename R = void>
using enable_if_binary_like = enable_if_t<is_binary_like_type<T>::value, R>#
template<typename T>
using is_decimal_type = std::is_base_of<DecimalType, T>#
template<typename T, typename R = void>
using enable_if_decimal = enable_if_t<is_decimal_type<T>::value, R>#
template<typename T>
using is_decimal128_type = std::is_base_of<Decimal128Type, T>#
template<typename T, typename R = void>
using enable_if_decimal128 = enable_if_t<is_decimal128_type<T>::value, R>#
template<typename T>
using is_decimal256_type = std::is_base_of<Decimal256Type, T>#
template<typename T, typename R = void>
using enable_if_decimal256 = enable_if_t<is_decimal256_type<T>::value, R>#
template<typename T>
using is_nested_type = std::is_base_of<NestedType, T>#
template<typename T, typename R = void>
using enable_if_nested = enable_if_t<is_nested_type<T>::value, R>#
template<typename T, typename R = void>
using enable_if_not_nested = enable_if_t<!is_nested_type<T>::value, R>#
template<typename T>
using is_var_length_list_type = std::integral_constant<bool, std::is_base_of<LargeListType, T>::value || std::is_base_of<ListType, T>::value>#
template<typename T, typename R = void>
using enable_if_var_size_list = enable_if_t<is_var_length_list_type<T>::value, R>#
template<typename T>
using is_base_list_type = is_var_length_list_type<T>#
template<typename T, typename R = void>
using enable_if_base_list = enable_if_var_size_list<T, R>#
template<typename T>
using is_fixed_size_list_type = std::is_same<FixedSizeListType, T>#
template<typename T, typename R = void>
using enable_if_fixed_size_list = enable_if_t<is_fixed_size_list_type<T>::value, R>#
template<typename T>
using is_list_type = std::integral_constant<bool, std::is_same<T, ListType>::value || std::is_same<T, LargeListType>::value || std::is_same<T, FixedSizeListType>::value>#
template<typename T, typename R = void>
using enable_if_list_type = enable_if_t<is_list_type<T>::value, R>#
template<typename T>
using is_list_view_type = std::disjunction<std::is_same<T, ListViewType>, std::is_same<T, LargeListViewType>>#
template<typename T, typename R = void>
using enable_if_list_view = enable_if_t<is_list_view_type<T>::value, R>#
template<typename T>
using is_list_like_type = std::integral_constant<bool, is_var_length_list_type<T>::value || is_fixed_size_list_type<T>::value>#
template<typename T, typename R = void>
using enable_if_list_like = enable_if_t<is_list_like_type<T>::value, R>#
template<typename T>
using is_var_length_list_like_type = std::disjunction<is_var_length_list_type<T>, is_list_view_type<T>>#
template<typename T, typename R = void>
using enable_if_var_length_list_like = enable_if_t<is_var_length_list_like_type<T>::value, R>#
template<typename T>
using is_struct_type = std::is_base_of<StructType, T>#
template<typename T, typename R = void>
using enable_if_struct = enable_if_t<is_struct_type<T>::value, R>#
template<typename T>
using is_union_type = std::is_base_of<UnionType, T>#
template<typename T, typename R = void>
using enable_if_union = enable_if_t<is_union_type<T>::value, R>#
template<typename T>
using is_temporal_type = std::is_base_of<TemporalType, T>#
template<typename T, typename R = void>
using enable_if_temporal = enable_if_t<is_temporal_type<T>::value, R>#
template<typename T>
using is_date_type = std::is_base_of<DateType, T>#
template<typename T, typename R = void>
using enable_if_date = enable_if_t<is_date_type<T>::value, R>#
template<typename T>
using is_time_type = std::is_base_of<TimeType, T>#
template<typename T, typename R = void>
using enable_if_time = enable_if_t<is_time_type<T>::value, R>#
template<typename T>
using is_timestamp_type = std::is_base_of<TimestampType, T>#
template<typename T, typename R = void>
using enable_if_timestamp = enable_if_t<is_timestamp_type<T>::value, R>#
template<typename T>
using is_duration_type = std::is_base_of<DurationType, T>#
template<typename T, typename R = void>
using enable_if_duration = enable_if_t<is_duration_type<T>::value, R>#
template<typename T>
using is_interval_type = std::is_base_of<IntervalType, T>#
template<typename T, typename R = void>
using enable_if_interval = enable_if_t<is_interval_type<T>::value, R>#
template<typename T>
using is_run_end_encoded_type = std::is_base_of<RunEndEncodedType, T>#
template<typename T, typename R = void>
using enable_if_run_end_encoded = enable_if_t<is_run_end_encoded_type<T>::value, R>#
template<typename T>
using is_dictionary_type = std::is_base_of<DictionaryType, T>#
template<typename T, typename R = void>
using enable_if_dictionary = enable_if_t<is_dictionary_type<T>::value, R>#
template<typename T>
using is_extension_type = std::is_base_of<ExtensionType, T>#
template<typename T, typename R = void>
using enable_if_extension = enable_if_t<is_extension_type<T>::value, R>#
template<typename T>
using is_primitive_ctype = std::is_base_of<PrimitiveCType, T>#
template<typename T, typename R = void>
using enable_if_primitive_ctype = enable_if_t<is_primitive_ctype<T>::value, R>#
template<typename T>
using has_c_type = std::integral_constant<bool, is_primitive_ctype<T>::value || is_temporal_type<T>::value>#
template<typename T, typename R = void>
using enable_if_has_c_type = enable_if_t<has_c_type<T>::value, R>#
template<typename T>
using has_string_view = std::integral_constant<bool, std::is_same<BinaryType, T>::value || std::is_same<BinaryViewType, T>::value || std::is_same<LargeBinaryType, T>::value || std::is_same<StringType, T>::value || std::is_same<StringViewType, T>::value || std::is_same<LargeStringType, T>::value || std::is_same<FixedSizeBinaryType, T>::value>#
template<typename T, typename R = void>
using enable_if_has_string_view = enable_if_t<has_string_view<T>::value, R>#
template<typename T>
using is_8bit_int = std::integral_constant<bool, std::is_same<UInt8Type, T>::value || std::is_same<Int8Type, T>::value>#
template<typename T, typename R = void>
using enable_if_8bit_int = enable_if_t<is_8bit_int<T>::value, R>#
template<typename T>
using is_parameter_free_type = std::integral_constant<bool, TypeTraits<T>::is_parameter_free>#
template<typename T, typename R = void>
using enable_if_parameter_free = enable_if_t<is_parameter_free_type<T>::value, R>#
template<typename T>
using is_physical_signed_integer_type = std::integral_constant<bool, is_signed_integer_type<T>::value || (is_temporal_type<T>::value && has_c_type<T>::value && std::is_integral<typename T::c_type>::value)>#
template<typename T, typename R = void>
using enable_if_physical_signed_integer = enable_if_t<is_physical_signed_integer_type<T>::value, R>#
template<typename T>
using is_physical_unsigned_integer_type = std::integral_constant<bool, is_unsigned_integer_type<T>::value || is_half_float_type<T>::value>#
template<typename T, typename R = void>
using enable_if_physical_unsigned_integer = enable_if_t<is_physical_unsigned_integer_type<T>::value, R>#
template<typename T>
using is_physical_integer_type = std::integral_constant<bool, is_physical_unsigned_integer_type<T>::value || is_physical_signed_integer_type<T>::value>#
template<typename T, typename R = void>
using enable_if_physical_integer = enable_if_t<is_physical_integer_type<T>::value, R>#
template<typename T>
using is_physical_floating_type = std::integral_constant<bool, is_floating_type<T>::value && !is_half_float_type<T>::value>#
template<typename T, typename R = void>
using enable_if_physical_floating_point = enable_if_t<is_physical_floating_type<T>::value, R>#

Runtime Type Predicates#

Type predicates that can be applied at runtime.

constexpr bool is_integer(Type::type type_id)#

Check for an integer type (signed or unsigned)

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is an integer type one

constexpr bool is_signed_integer(Type::type type_id)#

Check for a signed integer type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a signed integer type one

constexpr bool is_unsigned_integer(Type::type type_id)#

Check for an unsigned integer type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is an unsigned integer type one

constexpr bool is_floating(Type::type type_id)#

Check for a floating point type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a floating point type one

constexpr bool is_numeric(Type::type type_id)#

Check for a numeric type.

This predicate doesn’t match decimals (see is_decimal).

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a numeric type one

constexpr bool is_decimal(Type::type type_id)#

Check for a decimal type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a decimal type one

constexpr bool is_run_end_type(Type::type type_id)#

Check for a type that can be used as a run-end in Run-End Encoded arrays.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id can represent a run-end value

constexpr bool is_primitive(Type::type type_id)#

Check for a primitive type.

This predicate doesn’t match null, decimals and binary-like types.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a primitive type one

constexpr bool is_base_binary_like(Type::type type_id)#

Check for a base-binary-like type.

This predicate doesn’t match fixed-size binary types and will otherwise match all binary- and string-like types regardless of offset width.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a base-binary-like type one

constexpr bool is_binary_like(Type::type type_id)#

Check for a binary-like type (i.e.

with 32-bit offsets)

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a binary-like type one

constexpr bool is_large_binary_like(Type::type type_id)#

Check for a large-binary-like type (i.e.

with 64-bit offsets)

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a large-binary-like type one

constexpr bool is_binary(Type::type type_id)#

Check for a binary (non-string) type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a binary type one

constexpr bool is_string(Type::type type_id)#

Check for a string type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a string type one

constexpr bool is_temporal(Type::type type_id)#

Check for a temporal type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a temporal type one

constexpr bool is_time(Type::type type_id)#

Check for a time type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a primitive type one

constexpr bool is_date(Type::type type_id)#

Check for a date type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a primitive type one

constexpr bool is_interval(Type::type type_id)#

Check for an interval type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is an interval type one

constexpr bool is_dictionary(Type::type type_id)#

Check for a dictionary type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a dictionary type one

constexpr bool is_fixed_size_binary(Type::type type_id)#

Check for a fixed-size-binary type.

This predicate also matches decimals.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a fixed-size-binary type one

constexpr bool is_fixed_width(Type::type type_id)#

Check for a fixed-width type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a fixed-width type one

constexpr bool is_var_length_list(Type::type type_id)#

Check for a variable-length list type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a variable-length list type one

constexpr bool is_list(Type::type type_id)#

Check for a list type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a list type one

constexpr bool is_list_like(Type::type type_id)#

Check for a list-like type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a list-like type one

constexpr bool is_var_length_list_like(Type::type type_id)#

Check for a var-length list or list-view like type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a var-length list or list-view like type

constexpr bool is_list_view(Type::type type_id)#

Check for a list-view type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a list-view type one

constexpr bool is_nested(Type::type type_id)#

Check for a nested type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a nested type one

constexpr bool is_union(Type::type type_id)#

Check for a union type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a union type one

static inline int bit_width(Type::type type_id)#

Return the values bit width of a type.

For Type::FIXED_SIZE_BINARY, you will instead need to inspect the concrete DataType to get this information.

Parameters:

type_id[in] the type-id to check

Returns:

the values bit width, or 0 if the type does not have fixed-width values

static inline int offset_bit_width(Type::type type_id)#

Return the offsets bit width of a type.

Parameters:

type_id[in] the type-id to check

Returns:

the offsets bit width, or 0 if the type does not have offsets

int RequiredValueAlignmentForBuffer(Type::type type_id, int buffer_index)#

Get the alignment a buffer should have to be considered “value aligned”.

Some buffers are frequently type-punned. For example, in an int32 array the values buffer is frequently cast to int32_t*

This sort of punning is technically only valid if the pointer is aligned to a proper width (e.g. 4 bytes in the case of int32). However, most modern compilers are quite permissive if we get this wrong. Note that this alignment is something that is guaranteed by malloc (e.g. new int32_t[] will return a buffer that is 4 byte aligned) or common libraries (e.g. numpy) but it is not currently guaranteed by flight (GH-32276).

We call this “value aligned” and this method will calculate that required alignment.

Parameters:
  • type_id – the type of the array containing the buffer Note: this should be the indices type for a dictionary array since A dictionary array’s buffers are indices. It should be the storage type for an extension array.

  • buffer_index – the index of the buffer to check, for example 0 will typically give you the alignment expected of the validity buffer

Returns:

the required value alignment in bytes (1 if no alignment required)

static inline bool is_integer(const DataType &type)#

Check for an integer type (signed or unsigned)

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is an integer type

static inline bool is_signed_integer(const DataType &type)#

Check for a signed integer type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a signed integer type

static inline bool is_unsigned_integer(const DataType &type)#

Check for an unsigned integer type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is an unsigned integer type

static inline bool is_floating(const DataType &type)#

Check for a floating point type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a floating point type

static inline bool is_numeric(const DataType &type)#

Check for a numeric type (number except boolean type)

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a numeric type

static inline bool is_decimal(const DataType &type)#

Check for a decimal type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a decimal type

static inline bool is_primitive(const DataType &type)#

Check for a primitive type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a primitive type

static inline bool is_base_binary_like(const DataType &type)#

Check for a binary or string-like type (except fixed-size binary)

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a binary or string-like type

static inline bool is_binary_like(const DataType &type)#

Check for a binary-like type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a binary-like type

static inline bool is_large_binary_like(const DataType &type)#

Check for a large-binary-like type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a large-binary-like type

static inline bool is_binary(const DataType &type)#

Check for a binary type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a binary type

static inline bool is_string(const DataType &type)#

Check for a string type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a string type

static inline bool is_temporal(const DataType &type)#

Check for a temporal type, including time and timestamps for each unit.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a temporal type

static inline bool is_interval(const DataType &type)#

Check for an interval type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a interval type

static inline bool is_dictionary(const DataType &type)#

Check for a dictionary type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a dictionary type

static inline bool is_fixed_size_binary(const DataType &type)#

Check for a fixed-size-binary type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a fixed-size-binary type

static inline bool is_fixed_width(const DataType &type)#

Check for a fixed-width type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a fixed-width type

static inline bool is_var_length_list(const DataType &type)#

Check for a variable-length list type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a variable-length list type

static inline bool is_list_like(const DataType &type)#

Check for a list-like type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a list-like type

static inline bool is_var_length_list_like(const DataType &type)#

Check for a var-length list or list-view like type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a var-length list or list-view like type

static inline bool is_list_view(const DataType &type)#

Check for a list-view type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a list-view type

static inline bool is_nested(const DataType &type)#

Check for a nested type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a nested type

static inline bool is_union(const DataType &type)#

Check for a union type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a union type