Utilities#

Decimal Numbers#

classBasicDecimal128:publicarrow::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 byarrow::Decimal128

Public Functions

inlineconstexprBasicDecimal128(int64_thigh,uint64_tlow)noexcept#

Create aBasicDecimal128 from the two’s complement representation.

BasicDecimal128&Negate()#

Negate the current value (in-place)

BasicDecimal128&Abs()#

Absolute value (in-place)

BasicDecimal128&operator+=(constBasicDecimal128&right)#

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

BasicDecimal128&operator-=(constBasicDecimal128&right)#

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

BasicDecimal128&operator*=(constBasicDecimal128&right)#

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

DecimalStatusDivide(constBasicDecimal128&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/=(constBasicDecimal128&right)#

In-place division.

BasicDecimal128&operator|=(constBasicDecimal128&right)#

Bitwise “or” between twoBasicDecimal128.

BasicDecimal128&operator&=(constBasicDecimal128&right)#

Bitwise “and” between twoBasicDecimal128.

BasicDecimal128&operator<<=(uint32_tbits)#

Shift left by the given number of bits.

BasicDecimal128&operator>>=(uint32_tbits)#

Shift right by the given number of bits.

Negative values will sign-extend.

inlineconstexprint64_thigh_bits()const#

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

inlineconstexpruint64_tlow_bits()const#

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

voidGetWholeAndFraction(int32_tscale,BasicDecimal128*whole,BasicDecimal128*fraction)const#

separate the integer and fractional parts for the given scale.

DecimalStatusRescale(int32_toriginal_scale,int32_tnew_scale,BasicDecimal128*out)const#

ConvertBasicDecimal128 from one scale to another.

BasicDecimal128IncreaseScaleBy(int32_tincrease_by)const#

Scale up.

BasicDecimal128ReduceScaleBy(int32_treduce_by,boolround=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.

boolFitsInPrecision(int32_tprecision)const#

Whether this number fits in the given precision.

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

int32_tCountLeadingBinaryZeros()const#

count the number of leading binary zeroes.

inlineconstexprGenericBasicDecimal()noexcept#

Empty constructor creates a decimal with a value of 0.

inlineexplicitconstexprGenericBasicDecimal(constWordArray&array)noexcept#

Create a decimal from the two’s complement representation.

Input array is assumed to be in native endianness.

inlineGenericBasicDecimal(LittleEndianArrayTag,constWordArray&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<typenameT,typename=typenamestd::enable_if<std::is_integral<T>::value&&(sizeof(T)<=sizeof(uint64_t)),T>::type>
inlineconstexprGenericBasicDecimal(Tvalue)noexcept#

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

inlineexplicitGenericBasicDecimal(constuint8_t*bytes)#

Create a decimal from an array of bytes.

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

Public Static Functions

staticBasicDecimal128Abs(constBasicDecimal128&left)#

Absolute value.

staticconstBasicDecimal128&GetScaleMultiplier(int32_tscale)#

Scale multiplier for given scale value.

staticconstBasicDecimal128&GetHalfScaleMultiplier(int32_tscale)#

Half-scale multiplier for given scale value.

staticconstBasicDecimal128&GetMaxValue()#

Get the maximum valid unscaled decimal value.

staticBasicDecimal128GetMaxValue(int32_tprecision)#

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

staticinlineconstexprBasicDecimal128GetMaxSentinel()#

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

staticinlineconstexprBasicDecimal128GetMinSentinel()#

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

classDecimal128:publicarrow::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 ofBasicDecimal128 to deal with strings and streams.

Public Functions

inlineconstexprDecimal128(constBasicDecimal128&value)noexcept#

constructor creates aDecimal128 from aBasicDecimal128.

explicitDecimal128(conststd::string&value)#

Parse the number from a base 10 string representation.

inlineconstexprDecimal128()noexcept#

Empty constructor creates aDecimal128 with a value of 0.

inlineResult<std::pair<Decimal128,Decimal128>>Divide(constDecimal128&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::stringToString(int32_tscale)const#

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

std::stringToIntegerString()const#

Convert the value to an integer string.

explicitoperatorint64_t()const#

Cast this value to an int64_t.

inlineResult<Decimal128>Rescale(int32_toriginal_scale,int32_tnew_scale)const#

ConvertDecimal128 from one scale to another.

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

Convert to a signed integer.

template<typenameT,typename=internal::EnableIfIsOneOf<T,int32_t,int64_t>>
inlineStatusToInteger(T*out)const#

Convert to a signed integer.

floatToFloat(int32_tscale)const#

Convert to a floating-point number (scaled)

doubleToDouble(int32_tscale)const#

Convert to a floating-point number (scaled)

template<typenameT,typename=std::enable_if_t<std::is_floating_point_v<T>>>
inlineTToReal(int32_tscale)const#

Convert to a floating-point number (scaled)

Public Static Functions

staticStatusFromString(std::string_views,Decimal128*out,int32_t*precision,int32_t*scale=NULLPTR)#

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

staticResult<Decimal128>FromBigEndian(constuint8_t*data,int32_tlength)#

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

classBasicDecimal256:publicarrow::GenericBasicDecimal<BasicDecimal256,256>#

Subclassed byarrow::Decimal256

Public Functions

BasicDecimal256&Negate()#

Negate the current value (in-place)

BasicDecimal256&Abs()#

Absolute value (in-place)

BasicDecimal256&operator+=(constBasicDecimal256&right)#

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

BasicDecimal256&operator-=(constBasicDecimal256&right)#

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

inlineuint64_tlow_bits()const#

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

voidGetWholeAndFraction(int32_tscale,BasicDecimal256*whole,BasicDecimal256*fraction)const#

separate the integer and fractional parts for the given scale.

DecimalStatusRescale(int32_toriginal_scale,int32_tnew_scale,BasicDecimal256*out)const#

ConvertBasicDecimal256 from one scale to another.

BasicDecimal256IncreaseScaleBy(int32_tincrease_by)const#

Scale up.

BasicDecimal256ReduceScaleBy(int32_treduce_by,boolround=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.

boolFitsInPrecision(int32_tprecision)const#

Whether this number fits in the given precision.

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

BasicDecimal256&operator*=(constBasicDecimal256&right)#

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

DecimalStatusDivide(constBasicDecimal256&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_tbits)#

Shift left by the given number of bits.

BasicDecimal256&operator>>=(uint32_tbits)#

Shift right by the given number of bits.

Negative values will sign-extend.

BasicDecimal256&operator/=(constBasicDecimal256&right)#

In-place division.

inlineconstexprGenericBasicDecimal()noexcept#

Empty constructor creates a decimal with a value of 0.

inlineexplicitconstexprGenericBasicDecimal(constWordArray&array)noexcept#

Create a decimal from the two’s complement representation.

Input array is assumed to be in native endianness.

inlineGenericBasicDecimal(LittleEndianArrayTag,constWordArray&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<typenameT,typename=typenamestd::enable_if<std::is_integral<T>::value&&(sizeof(T)<=sizeof(uint64_t)),T>::type>
inlineconstexprGenericBasicDecimal(Tvalue)noexcept#

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

inlineexplicitGenericBasicDecimal(constuint8_t*bytes)#

Create a decimal from an array of bytes.

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

Public Static Functions

staticBasicDecimal256Abs(constBasicDecimal256&left)#

Absolute value.

staticconstBasicDecimal256&GetScaleMultiplier(int32_tscale)#

Scale multiplier for given scale value.

staticconstBasicDecimal256&GetHalfScaleMultiplier(int32_tscale)#

Half-scale multiplier for given scale value.

staticBasicDecimal256GetMaxValue(int32_tprecision)#

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

staticinlineconstexprBasicDecimal256GetMaxSentinel()#

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

staticinlineconstexprBasicDecimal256GetMinSentinel()#

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

classDecimal256:publicarrow::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 ofBasicDecimal256 to deal with strings and streams.

Public Functions

inlineconstexprDecimal256(constBasicDecimal256&value)noexcept#

constructor creates aDecimal256 from aBasicDecimal256.

explicitDecimal256(conststd::string&value)#

Parse the number from a base 10 string representation.

inlineconstexprDecimal256()noexcept#

Empty constructor creates aDecimal256 with a value of 0.

std::stringToString(int32_tscale)const#

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

std::stringToIntegerString()const#

Convert the value to an integer string.

inlineResult<Decimal256>Rescale(int32_toriginal_scale,int32_tnew_scale)const#

ConvertDecimal256 from one scale to another.

inlineResult<std::pair<Decimal256,Decimal256>>Divide(constDecimal256&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

floatToFloat(int32_tscale)const#

Convert to a floating-point number (scaled).

May return infinity in case of overflow.

doubleToDouble(int32_tscale)const#

Convert to a floating-point number (scaled)

template<typenameT,typename=std::enable_if_t<std::is_floating_point_v<T>>>
inlineTToReal(int32_tscale)const#

Convert to a floating-point number (scaled)

Public Static Functions

staticStatusFromString(std::string_views,Decimal256*out,int32_t*precision,int32_t*scale=NULLPTR)#

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

staticResult<Decimal256>FromBigEndian(constuint8_t*data,int32_tlength)#

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<typenameT>
classIterator:publicarrow::util::EqualityComparable<Iterator<T>>#

A genericIterator that can return errors.

Public Functions

template<typenameWrapped>
inlineexplicitIterator(Wrappedhas_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.

inlineResult<T>Next()#

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

template<typenameVisitor>
inlineStatusVisit(Visitor&&visitor)#

Pass each element of the sequence to a visitor.

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

inlineboolEquals(constIterator&other)const#

Iterators will only compare equal if they are both null.

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

inlineResult<std::vector<T>>ToVector()#

Move every element of this iterator into a vector.

classRangeIterator#
template<typenameT>
classVectorIterator#

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

Comparison#

classEqualOptions#

A container of options for equality comparisons.

Public Functions

inlineboolnans_equal()const#

Whether or not NaNs are considered equal.

inlineEqualOptionsnans_equal(boolv)const#

Return a newEqualOptions object with the “nans_equal” property changed.

inlineboolsigned_zeros_equal()const#

Whether or not zeros with differing signs are considered equal.

inlineEqualOptionssigned_zeros_equal(boolv)const#

Return a newEqualOptions object with the “signed_zeros_equal” property changed.

inlinebooluse_atol()const#

Whether the “atol” property is used in the comparison.

This option only affects the Equals methods and has no effect on ApproxEquals methods.

inlineEqualOptionsuse_atol(boolv)const#

Return a newEqualOptions object with the “use_atol” property changed.

inlinedoubleatol()const#

The absolute tolerance for approximate comparisons of floating-point values.

Note that this option is ignored if “use_atol” is set to false.

inlineEqualOptionsatol(doublev)const#

Return a newEqualOptions object with the “atol” property changed.

inlinebooluse_schema()const#

Whether thearrow::Schema property is used in the comparison.

This option only affects the Equals methods and has no effect on ApproxEquals methods.

inlineEqualOptionsuse_schema(boolv)const#

Return a newEqualOptions object with the “use_schema_” property changed.

Setting this option is false making the value ofEqualOptions::use_metadata is ignored.

inlinebooluse_metadata()const#

Whether the “metadata” inarrow::Schema is used in the comparison.

This option only affects the Equals methods and has no effect on the ApproxEquals methods.

Note: This option is only considered whenarrow::EqualOptions::use_schema is set to true.

inlineEqualOptionsuse_metadata(boolv)const#

Return a newEqualOptions object with the “use_metadata” property changed.

inlinestd::ostream*diff_sink()const#

The ostream to which a diff will be formatted if arrays disagree.

If this is null (the default) no diff will be formatted.

inlineEqualOptionsdiff_sink(std::ostream*diff_sink)const#

Return a newEqualOptions object with the “diff_sink” property changed.

This option will be ignored if diff formatting of the types of compared arrays is not supported.

Compression#

enumarrow::Compression::type#

Compression algorithm.

Values:

enumeratorUNCOMPRESSED#
enumeratorSNAPPY#
enumeratorGZIP#
enumeratorBROTLI#
enumeratorZSTD#
enumeratorLZ4#
enumeratorLZ4_FRAME#
enumeratorLZO#
enumeratorBZ2#
enumeratorLZ4_HADOOP#
classCodec#

Compression codec.

Public Functions

virtualintminimum_compression_level()const=0#

Return the smallest supported compression level.

virtualintmaximum_compression_level()const=0#

Return the largest supported compression level.

virtualintdefault_compression_level()const=0#

Return the default compression level.

virtualResult<int64_t>Decompress(int64_tinput_len,constuint8_t*input,int64_toutput_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.

virtualResult<int64_t>Compress(int64_tinput_len,constuint8_t*input,int64_toutput_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.

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

Create a streaming compressor instance.

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

Create a streaming compressor instance.

virtualCompression::typecompression_type()const=0#

ThisCodec’s compression type.

inlineconststd::string&name()const#

The name of thisCodec’s compression type.

inlinevirtualintcompression_level()const#

ThisCodec’s compression level, if applicable.

Public Static Functions

staticintUseDefaultCompressionLevel()#

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

staticconststd::string&GetCodecAsString(Compression::typet)#

Return a string name for compression type.

staticResult<Compression::type>GetCompressionType(conststd::string&name)#

Return compression type for name (all lower case)

staticResult<std::unique_ptr<Codec>>Create(Compression::typecodec,constCodecOptions&codec_options=CodecOptions{})#

Create a codec for the given compression algorithm with CodecOptions.

staticResult<std::unique_ptr<Codec>>Create(Compression::typecodec,intcompression_level)#

Create a codec for the given compression algorithm.

staticboolIsAvailable(Compression::typecodec)#

Return true if support for indicated codec has been enabled.

staticboolSupportsCompressionLevel(Compression::typecodec)#

Return true if indicated codec supports setting a compression level.

staticResult<int>MinimumCompressionLevel(Compression::typecodec)#

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

staticResult<int>MaximumCompressionLevel(Compression::typecodec)#

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

staticResult<int>DefaultCompressionLevel(Compression::typecodec)#

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

classCompressor#

Streaming compressor interface.

Public Functions

virtualResult<CompressResult>Compress(int64_tinput_len,constuint8_t*input,int64_toutput_len,uint8_t*output)=0#

Compress some input.

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

virtualResult<FlushResult>Flush(int64_toutput_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.

virtualResult<EndResult>End(int64_toutput_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, theCompressor should not be used anymore.

End() impliesFlush().

structCompressResult#
structEndResult#
structFlushResult#
classDecompressor#

Streaming decompressor interface.

Public Functions

virtualResult<DecompressResult>Decompress(int64_tinput_len,constuint8_t*input,int64_toutput_len,uint8_t*output)=0#

Decompress some input.

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

virtualboolIsFinished()=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.

virtualStatusReset()=0#

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

structDecompressResult#

Visitors#

template<typenameVISITOR,typename...ARGS>
inlineStatusarrow::VisitTypeInline(constDataType&type,VISITOR*visitor,ARGS&&...args)#

Callsvisitor with the corresponding concrete type class.

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

classExampleVisitor{arrow::StatusVisit(constarrow::Int32Type&type){...}arrow::StatusVisit(constarrow::Int64Type&type){...}...}ExampleVisitorvisitor;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 thetype argument

Returns:

Status

template<typenameVISITOR,typename...ARGS>
inlineStatusarrow::VisitTypeIdInline(Type::typeid,VISITOR*visitor,ARGS&&...args)#

Callsvisitor 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 thetype argument

Returns:

Status

template<typenameVISITOR,typename...ARGS>
inlineStatusarrow::VisitScalarInline(constScalar&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:

classExampleVisitor{arrow::StatusVisit(arrow::Int32Scalarscalar){...}arrow::StatusVisit(arrow::Int64Scalarscalar){...}...}ExampleVisitorvisitor;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 thescalar argument

Returns:

Status

template<typenameVISITOR,typename...ARGS>
inlineStatusarrow::VisitArrayInline(constArray&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:

classExampleVisitor{arrow::StatusVisit(arrow::NumericArray<Int32Type>arr){...}arrow::StatusVisit(arrow::NumericArray<Int64Type>arr){...}...}ExampleVisitorvisitor;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 thearr argument

Returns:

Status

Type Traits#

These types provide relationships between Arrow types at compiletime.TypeTraits maps Arrow DataTypes to other types, andCTypeTraits maps C types to Arrow types.

TypeTraits#

Each specialized type defines the following associated types:

typeTypeTraits::ArrayType#

CorrespondingArrow array type

typeTypeTraits::BuilderType#

Correspondingarray builder type

typeTypeTraits::ScalarType#

CorrespondingArrow scalar type

boolTypeTraits::is_parameter_free#

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

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

typeTypeTraits::CType#

Corresponding C type. For example,int64_t forInt64Array.

typeTypeTraits::TensorType#

CorrespondingArrow tensor type

staticinlineconstexprint64_tbytes_required(int64_telements)#

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

staticinlinestd::shared_ptr<DataType>TypeTraits::type_singleton()#

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

template<>
structTypeTraits<NullType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=NullArray#
usingBuilderType=NullBuilder#
usingScalarType=NullScalar#

Public Static Functions

staticinlineconstexprint64_tbytes_required(int64_t)#
staticinlinestd::shared_ptr<DataType>type_singleton()#

Public Static Attributes

staticconstexprboolis_parameter_free=true#
template<>
structTypeTraits<BooleanType>#
#include <arrow/type_traits.h>

Subclassed by arrow::CTypeTraits< bool >

Public Types

usingArrayType=BooleanArray#
usingBuilderType=BooleanBuilder#
usingScalarType=BooleanScalar#
usingCType=bool#

Public Static Functions

staticinlineconstexprint64_tbytes_required(int64_telements)#
staticinlinestd::shared_ptr<DataType>type_singleton()#

Public Static Attributes

staticconstexprboolis_parameter_free=true#
template<>
structTypeTraits<Date64Type>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=Date64Array#
usingBuilderType=Date64Builder#
usingScalarType=Date64Scalar#
usingCType=Date64Type::c_type#

Public Static Functions

staticinlineconstexprint64_tbytes_required(int64_telements)#
staticinlinestd::shared_ptr<DataType>type_singleton()#

Public Static Attributes

staticconstexprboolis_parameter_free=true#
template<>
structTypeTraits<Date32Type>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=Date32Array#
usingBuilderType=Date32Builder#
usingScalarType=Date32Scalar#
usingCType=Date32Type::c_type#

Public Static Functions

staticinlineconstexprint64_tbytes_required(int64_telements)#
staticinlinestd::shared_ptr<DataType>type_singleton()#

Public Static Attributes

staticconstexprboolis_parameter_free=true#
template<>
structTypeTraits<TimestampType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=TimestampArray#
usingBuilderType=TimestampBuilder#
usingScalarType=TimestampScalar#
usingCType=TimestampType::c_type#

Public Static Functions

staticinlineconstexprint64_tbytes_required(int64_telements)#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<DurationType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=DurationArray#
usingBuilderType=DurationBuilder#
usingScalarType=DurationScalar#
usingCType=DurationType::c_type#

Public Static Functions

staticinlineconstexprint64_tbytes_required(int64_telements)#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<DayTimeIntervalType>#
#include <arrow/type_traits.h>

Subclassed byarrow::CTypeTraits< DayTimeIntervalType::DayMilliseconds >

Public Types

usingArrayType=DayTimeIntervalArray#
usingBuilderType=DayTimeIntervalBuilder#
usingScalarType=DayTimeIntervalScalar#
usingCType=DayTimeIntervalType::c_type#

Public Static Functions

staticinlineconstexprint64_tbytes_required(int64_telements)#
staticinlinestd::shared_ptr<DataType>type_singleton()#

Public Static Attributes

staticconstexprboolis_parameter_free=true#
template<>
structTypeTraits<MonthDayNanoIntervalType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=MonthDayNanoIntervalArray#
usingBuilderType=MonthDayNanoIntervalBuilder#
usingScalarType=MonthDayNanoIntervalScalar#
usingCType=MonthDayNanoIntervalType::c_type#

Public Static Functions

staticinlineconstexprint64_tbytes_required(int64_telements)#
staticinlinestd::shared_ptr<DataType>type_singleton()#

Public Static Attributes

staticconstexprboolis_parameter_free=true#
template<>
structTypeTraits<MonthIntervalType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=MonthIntervalArray#
usingBuilderType=MonthIntervalBuilder#
usingScalarType=MonthIntervalScalar#
usingCType=MonthIntervalType::c_type#

Public Static Functions

staticinlineconstexprint64_tbytes_required(int64_telements)#
staticinlinestd::shared_ptr<DataType>type_singleton()#

Public Static Attributes

staticconstexprboolis_parameter_free=true#
template<>
structTypeTraits<Time32Type>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=Time32Array#
usingBuilderType=Time32Builder#
usingScalarType=Time32Scalar#
usingCType=Time32Type::c_type#

Public Static Functions

staticinlineconstexprint64_tbytes_required(int64_telements)#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<Time64Type>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=Time64Array#
usingBuilderType=Time64Builder#
usingScalarType=Time64Scalar#
usingCType=Time64Type::c_type#

Public Static Functions

staticinlineconstexprint64_tbytes_required(int64_telements)#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<HalfFloatType>#
#include <arrow/type_traits.h>

Subclassed byarrow::CTypeTraits< util::Float16 >

Public Types

usingArrayType=HalfFloatArray#
usingBuilderType=HalfFloatBuilder#
usingScalarType=HalfFloatScalar#
usingTensorType=HalfFloatTensor#
usingCType=uint16_t#

Public Static Functions

staticinlineconstexprint64_tbytes_required(int64_telements)#
staticinlinestd::shared_ptr<DataType>type_singleton()#

Public Static Attributes

staticconstexprboolis_parameter_free=true#
template<>
structCTypeTraits<util::Float16>:publicarrow::TypeTraits<HalfFloatType>#
#include <arrow/type_traits.h>

Public Types

usingArrowType=HalfFloatType#
template<>
structTypeTraits<Decimal32Type>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=Decimal32Array#
usingBuilderType=Decimal32Builder#
usingScalarType=Decimal32Scalar#
usingCType=Decimal32#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<Decimal64Type>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=Decimal64Array#
usingBuilderType=Decimal64Builder#
usingScalarType=Decimal64Scalar#
usingCType=Decimal64#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<Decimal128Type>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=Decimal128Array#
usingBuilderType=Decimal128Builder#
usingScalarType=Decimal128Scalar#
usingCType=Decimal128#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<Decimal256Type>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=Decimal256Array#
usingBuilderType=Decimal256Builder#
usingScalarType=Decimal256Scalar#
usingCType=Decimal256#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<BinaryType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=BinaryArray#
usingBuilderType=BinaryBuilder#
usingScalarType=BinaryScalar#
usingOffsetType=Int32Type#

Public Static Functions

staticinlinestd::shared_ptr<DataType>type_singleton()#

Public Static Attributes

staticconstexprboolis_parameter_free=true#
template<>
structTypeTraits<BinaryViewType>#
#include <arrow/type_traits.h>

Subclassed byarrow::CTypeTraits< BinaryViewType::c_type >

Public Types

usingArrayType=BinaryViewArray#
usingBuilderType=BinaryViewBuilder#
usingScalarType=BinaryViewScalar#
usingCType=BinaryViewType::c_type#

Public Static Functions

staticinlinestd::shared_ptr<DataType>type_singleton()#

Public Static Attributes

staticconstexprboolis_parameter_free=true#
template<>
structTypeTraits<LargeBinaryType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=LargeBinaryArray#
usingBuilderType=LargeBinaryBuilder#
usingScalarType=LargeBinaryScalar#
usingOffsetType=Int64Type#

Public Static Functions

staticinlinestd::shared_ptr<DataType>type_singleton()#

Public Static Attributes

staticconstexprboolis_parameter_free=true#
template<>
structTypeTraits<FixedSizeBinaryType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=FixedSizeBinaryArray#
usingBuilderType=FixedSizeBinaryBuilder#
usingScalarType=FixedSizeBinaryScalar#
usingOffsetType=Int32Type#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<StringType>#
#include <arrow/type_traits.h>

Subclassed byarrow::CTypeTraits< std::string >

Public Types

usingArrayType=StringArray#
usingBuilderType=StringBuilder#
usingScalarType=StringScalar#
usingOffsetType=Int32Type#

Public Static Functions

staticinlinestd::shared_ptr<DataType>type_singleton()#

Public Static Attributes

staticconstexprboolis_parameter_free=true#
template<>
structTypeTraits<StringViewType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=StringViewArray#
usingBuilderType=StringViewBuilder#
usingScalarType=StringViewScalar#
usingCType=BinaryViewType::c_type#

Public Static Functions

staticinlinestd::shared_ptr<DataType>type_singleton()#

Public Static Attributes

staticconstexprboolis_parameter_free=true#
template<>
structTypeTraits<LargeStringType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=LargeStringArray#
usingBuilderType=LargeStringBuilder#
usingScalarType=LargeStringScalar#
usingOffsetType=Int64Type#

Public Static Functions

staticinlinestd::shared_ptr<DataType>type_singleton()#

Public Static Attributes

staticconstexprboolis_parameter_free=true#
template<>
structTypeTraits<RunEndEncodedType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=RunEndEncodedArray#
usingBuilderType=RunEndEncodedBuilder#
usingScalarType=RunEndEncodedScalar#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<ListType>#
#include <arrow/type_traits.h>

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

Public Types

usingArrayType=ListArray#
usingBuilderType=ListBuilder#
usingScalarType=ListScalar#
usingOffsetType=Int32Type#
usingOffsetArrayType=Int32Array#
usingOffsetBuilderType=Int32Builder#
usingOffsetScalarType=Int32Scalar#
usingLargeType=LargeListType#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<LargeListType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=LargeListArray#
usingBuilderType=LargeListBuilder#
usingScalarType=LargeListScalar#
usingOffsetType=Int64Type#
usingOffsetArrayType=Int64Array#
usingOffsetBuilderType=Int64Builder#
usingOffsetScalarType=Int64Scalar#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<ListViewType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=ListViewArray#
usingBuilderType=ListViewBuilder#
usingScalarType=ListViewScalar#
usingOffsetType=Int32Type#
usingOffsetArrayType=Int32Array#
usingOffsetBuilderType=Int32Builder#
usingOffsetScalarType=Int32Scalar#
usingLargeType=LargeListViewType#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<LargeListViewType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=LargeListViewArray#
usingBuilderType=LargeListViewBuilder#
usingScalarType=LargeListViewScalar#
usingOffsetType=Int64Type#
usingOffsetArrayType=Int64Array#
usingOffsetBuilderType=Int64Builder#
usingOffsetScalarType=Int64Scalar#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<MapType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=MapArray#
usingBuilderType=MapBuilder#
usingScalarType=MapScalar#
usingOffsetType=Int32Type#
usingOffsetArrayType=Int32Array#
usingOffsetBuilderType=Int32Builder#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<FixedSizeListType>#
#include <arrow/type_traits.h>

Subclassed by arrow::CTypeTraits< std::array< CType, N > >

Public Types

usingArrayType=FixedSizeListArray#
usingBuilderType=FixedSizeListBuilder#
usingScalarType=FixedSizeListScalar#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<StructType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=StructArray#
usingBuilderType=StructBuilder#
usingScalarType=StructScalar#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<SparseUnionType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=SparseUnionArray#
usingBuilderType=SparseUnionBuilder#
usingScalarType=SparseUnionScalar#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<DenseUnionType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=DenseUnionArray#
usingBuilderType=DenseUnionBuilder#
usingScalarType=DenseUnionScalar#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<DictionaryType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=DictionaryArray#
usingScalarType=DictionaryScalar#

Public Static Attributes

staticconstexprboolis_parameter_free=false#
template<>
structTypeTraits<ExtensionType>#
#include <arrow/type_traits.h>

Public Types

usingArrayType=ExtensionArray#
usingScalarType=ExtensionScalar#

Public Static Attributes

staticconstexprboolis_parameter_free=false#

CTypeTraits#

Each specialized type defines the following associated types:

typeCTypeTraits::ArrowType#

CorrespondingArrow type

template<>
structCTypeTraits<std::string>:publicarrow::TypeTraits<StringType>#
#include <arrow/type_traits.h>

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

Public Types

usingArrowType=StringType#
template<>
structCTypeTraits<BinaryViewType::c_type>:publicarrow::TypeTraits<BinaryViewType>#
#include <arrow/type_traits.h>

Public Types

usingArrowType=BinaryViewType#
template<>
structCTypeTraits<constchar*>:publicarrow::CTypeTraits<std::string>#
#include <arrow/type_traits.h>
template<size_tN>
structCTypeTraits<constchar(&)[N]>:publicarrow::CTypeTraits<std::string>#
#include <arrow/type_traits.h>
template<>
structCTypeTraits<DayTimeIntervalType::DayMilliseconds>:publicarrow::TypeTraits<DayTimeIntervalType>#
#include <arrow/type_traits.h>

Public Types

usingArrowType=DayTimeIntervalType#

Type Predicates#

Type predicates that can be used with templates. Predicates of the formis_XXXresolve to constant boolean values, while predicates of the formenable_if_XXXresolve to the second type parameterR if the first parameterT passesthe test.

Example usage:

template<typenameTypeClass>arrow::enable_if_number<TypeClass,RETURN_TYPE>MyFunction(constTypeClass&type){..}template<typenameArrayType,typenameTypeClass=ArrayType::TypeClass>arrow::enable_if_number<TypeClass,RETURN_TYPE>MyFunction(constArrayType&array){..}
template<boolB,typenameT=void>
usingenable_if_t=typenamestd::enable_if<B,T>::type#
template<typenameT>
usingis_null_type=std::is_same<NullType,T>#
template<typenameT,typenameR=void>
usingenable_if_null=enable_if_t<is_null_type<T>::value,R>#
template<typenameT>
usingis_boolean_type=std::is_same<BooleanType,T>#
template<typenameT,typenameR=void>
usingenable_if_boolean=enable_if_t<is_boolean_type<T>::value,R>#
template<typenameT>
usingis_number_type=std::is_base_of<NumberType,T>#
template<typenameT,typenameR=void>
usingenable_if_number=enable_if_t<is_number_type<T>::value,R>#
template<typenameT>
usingis_integer_type=std::is_base_of<IntegerType,T>#
template<typenameT,typenameR=void>
usingenable_if_integer=enable_if_t<is_integer_type<T>::value,R>#
template<typenameT>
usingis_signed_integer_type=std::integral_constant<bool,is_integer_type<T>::value&&std::is_signed<typenameT::c_type>::value>#
template<typenameT,typenameR=void>
usingenable_if_signed_integer=enable_if_t<is_signed_integer_type<T>::value,R>#
template<typenameT>
usingis_unsigned_integer_type=std::integral_constant<bool,is_integer_type<T>::value&&std::is_unsigned<typenameT::c_type>::value>#
template<typenameT,typenameR=void>
usingenable_if_unsigned_integer=enable_if_t<is_unsigned_integer_type<T>::value,R>#
template<typenameT>
usingis_floating_type=std::is_base_of<FloatingPointType,T>#
template<typenameT,typenameR=void>
usingenable_if_floating_point=enable_if_t<is_floating_type<T>::value,R>#
template<typenameT>
usingis_half_float_type=std::is_same<HalfFloatType,T>#
template<typenameT,typenameR=void>
usingenable_if_half_float=enable_if_t<is_half_float_type<T>::value,R>#
template<typenameT>
usingis_base_binary_type=std::is_base_of<BaseBinaryType,T>#
template<typenameT,typenameR=void>
usingenable_if_base_binary=enable_if_t<is_base_binary_type<T>::value,R>#
template<typenameT>
usingis_binary_type=std::integral_constant<bool,std::is_same<BinaryType,T>::value||std::is_same<LargeBinaryType,T>::value>#
template<typenameT,typenameR=void>
usingenable_if_binary=enable_if_t<is_binary_type<T>::value,R>#
template<typenameT>
usingis_string_type=std::integral_constant<bool,std::is_same<StringType,T>::value||std::is_same<LargeStringType,T>::value>#
template<typenameT,typenameR=void>
usingenable_if_string=enable_if_t<is_string_type<T>::value,R>#
template<typenameT>
usingis_binary_view_like_type=std::is_base_of<BinaryViewType,T>#
template<typenameT>
usingis_binary_view_type=std::is_same<BinaryViewType,T>#
template<typenameT>
usingis_string_view_type=std::is_same<StringViewType,T>#
template<typenameT,typenameR=void>
usingenable_if_binary_view_like=enable_if_t<is_binary_view_like_type<T>::value,R>#
template<typenameT,typenameR=void>
usingenable_if_binary_view=enable_if_t<is_binary_view_type<T>::value,R>#
template<typenameT,typenameR=void>
usingenable_if_string_view=enable_if_t<is_string_view_type<T>::value,R>#
template<typenameT>
usingis_string_like_type=std::integral_constant<bool,is_base_binary_type<T>::value&&T::is_utf8>#
template<typenameT,typenameR=void>
usingenable_if_string_like=enable_if_t<is_string_like_type<T>::value,R>#
template<typenameT,typenameU,typenameR=void>
usingenable_if_same=enable_if_t<std::is_same<T,U>::value,R>#
template<typenameT>
usingis_fixed_size_binary_type=std::is_base_of<FixedSizeBinaryType,T>#
template<typenameT,typenameR=void>
usingenable_if_fixed_size_binary=enable_if_t<is_fixed_size_binary_type<T>::value,R>#
template<typenameT>
usingis_fixed_width_type=std::is_base_of<FixedWidthType,T>#
template<typenameT,typenameR=void>
usingenable_if_fixed_width_type=enable_if_t<is_fixed_width_type<T>::value,R>#
template<typenameT>
usingis_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<typenameT,typenameR=void>
usingenable_if_binary_like=enable_if_t<is_binary_like_type<T>::value,R>#
template<typenameT>
usingis_decimal_type=std::is_base_of<DecimalType,T>#
template<typenameT,typenameR=void>
usingenable_if_decimal=enable_if_t<is_decimal_type<T>::value,R>#
template<typenameT>
usingis_decimal32_type=std::is_base_of<Decimal32Type,T>#
template<typenameT,typenameR=void>
usingenable_if_decimal32=enable_if_t<is_decimal32_type<T>::value,R>#
template<typenameT>
usingis_decimal64_type=std::is_base_of<Decimal64Type,T>#
template<typenameT,typenameR=void>
usingenable_if_decimal64=enable_if_t<is_decimal64_type<T>::value,R>#
template<typenameT>
usingis_decimal128_type=std::is_base_of<Decimal128Type,T>#
template<typenameT,typenameR=void>
usingenable_if_decimal128=enable_if_t<is_decimal128_type<T>::value,R>#
template<typenameT>
usingis_decimal256_type=std::is_base_of<Decimal256Type,T>#
template<typenameT,typenameR=void>
usingenable_if_decimal256=enable_if_t<is_decimal256_type<T>::value,R>#
template<typenameT>
usingis_nested_type=std::is_base_of<NestedType,T>#
template<typenameT,typenameR=void>
usingenable_if_nested=enable_if_t<is_nested_type<T>::value,R>#
template<typenameT,typenameR=void>
usingenable_if_not_nested=enable_if_t<!is_nested_type<T>::value,R>#
template<typenameT>
usingis_var_length_list_type=std::integral_constant<bool,std::is_base_of<LargeListType,T>::value||std::is_base_of<ListType,T>::value>#
template<typenameT,typenameR=void>
usingenable_if_var_size_list=enable_if_t<is_var_length_list_type<T>::value,R>#
template<typenameT>
usingis_base_list_type=is_var_length_list_type<T>#
template<typenameT,typenameR=void>
usingenable_if_base_list=enable_if_var_size_list<T,R>#
template<typenameT>
usingis_fixed_size_list_type=std::is_same<FixedSizeListType,T>#
template<typenameT,typenameR=void>
usingenable_if_fixed_size_list=enable_if_t<is_fixed_size_list_type<T>::value,R>#
template<typenameT>
usingis_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<typenameT,typenameR=void>
usingenable_if_list_type=enable_if_t<is_list_type<T>::value,R>#
template<typenameT>
usingis_list_view_type=std::disjunction<std::is_same<T,ListViewType>,std::is_same<T,LargeListViewType>>#
template<typenameT,typenameR=void>
usingenable_if_list_view=enable_if_t<is_list_view_type<T>::value,R>#
template<typenameT>
usingis_list_like_type=std::integral_constant<bool,is_var_length_list_type<T>::value||is_fixed_size_list_type<T>::value>#
template<typenameT,typenameR=void>
usingenable_if_list_like=enable_if_t<is_list_like_type<T>::value,R>#
template<typenameT>
usingis_var_length_list_like_type=std::disjunction<is_var_length_list_type<T>,is_list_view_type<T>>#
template<typenameT,typenameR=void>
usingenable_if_var_length_list_like=enable_if_t<is_var_length_list_like_type<T>::value,R>#
template<typenameT>
usingis_struct_type=std::is_base_of<StructType,T>#
template<typenameT,typenameR=void>
usingenable_if_struct=enable_if_t<is_struct_type<T>::value,R>#
template<typenameT>
usingis_union_type=std::is_base_of<UnionType,T>#
template<typenameT,typenameR=void>
usingenable_if_union=enable_if_t<is_union_type<T>::value,R>#
template<typenameT>
usingis_temporal_type=std::is_base_of<TemporalType,T>#
template<typenameT,typenameR=void>
usingenable_if_temporal=enable_if_t<is_temporal_type<T>::value,R>#
template<typenameT>
usingis_date_type=std::is_base_of<DateType,T>#
template<typenameT,typenameR=void>
usingenable_if_date=enable_if_t<is_date_type<T>::value,R>#
template<typenameT>
usingis_time_type=std::is_base_of<TimeType,T>#
template<typenameT,typenameR=void>
usingenable_if_time=enable_if_t<is_time_type<T>::value,R>#
template<typenameT>
usingis_timestamp_type=std::is_base_of<TimestampType,T>#
template<typenameT,typenameR=void>
usingenable_if_timestamp=enable_if_t<is_timestamp_type<T>::value,R>#
template<typenameT>
usingis_duration_type=std::is_base_of<DurationType,T>#
template<typenameT,typenameR=void>
usingenable_if_duration=enable_if_t<is_duration_type<T>::value,R>#
template<typenameT>
usingis_interval_type=std::is_base_of<IntervalType,T>#
template<typenameT,typenameR=void>
usingenable_if_interval=enable_if_t<is_interval_type<T>::value,R>#
template<typenameT>
usingis_run_end_encoded_type=std::is_base_of<RunEndEncodedType,T>#
template<typenameT,typenameR=void>
usingenable_if_run_end_encoded=enable_if_t<is_run_end_encoded_type<T>::value,R>#
template<typenameT>
usingis_dictionary_type=std::is_base_of<DictionaryType,T>#
template<typenameT,typenameR=void>
usingenable_if_dictionary=enable_if_t<is_dictionary_type<T>::value,R>#
template<typenameT>
usingis_extension_type=std::is_base_of<ExtensionType,T>#
template<typenameT,typenameR=void>
usingenable_if_extension=enable_if_t<is_extension_type<T>::value,R>#
template<typenameT>
usingis_primitive_ctype=std::is_base_of<PrimitiveCType,T>#
template<typenameT,typenameR=void>
usingenable_if_primitive_ctype=enable_if_t<is_primitive_ctype<T>::value,R>#
template<typenameT>
usinghas_c_type=std::integral_constant<bool,is_primitive_ctype<T>::value||is_temporal_type<T>::value>#
template<typenameT,typenameR=void>
usingenable_if_has_c_type=enable_if_t<has_c_type<T>::value,R>#
template<typenameT>
usinghas_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<typenameT,typenameR=void>
usingenable_if_has_string_view=enable_if_t<has_string_view<T>::value,R>#
template<typenameT>
usingis_8bit_int=std::integral_constant<bool,std::is_same<UInt8Type,T>::value||std::is_same<Int8Type,T>::value>#
template<typenameT,typenameR=void>
usingenable_if_8bit_int=enable_if_t<is_8bit_int<T>::value,R>#
template<typenameT>
usingis_parameter_free_type=std::integral_constant<bool,TypeTraits<T>::is_parameter_free>#
template<typenameT,typenameR=void>
usingenable_if_parameter_free=enable_if_t<is_parameter_free_type<T>::value,R>#
template<typenameT>
usingis_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<typenameT::c_type>::value)>#
template<typenameT,typenameR=void>
usingenable_if_physical_signed_integer=enable_if_t<is_physical_signed_integer_type<T>::value,R>#
template<typenameT>
usingis_physical_unsigned_integer_type=std::integral_constant<bool,is_unsigned_integer_type<T>::value||is_half_float_type<T>::value>#
template<typenameT,typenameR=void>
usingenable_if_physical_unsigned_integer=enable_if_t<is_physical_unsigned_integer_type<T>::value,R>#
template<typenameT>
usingis_physical_integer_type=std::integral_constant<bool,is_physical_unsigned_integer_type<T>::value||is_physical_signed_integer_type<T>::value>#
template<typenameT,typenameR=void>
usingenable_if_physical_integer=enable_if_t<is_physical_integer_type<T>::value,R>#
template<typenameT>
usingis_physical_floating_type=std::integral_constant<bool,is_floating_type<T>::value&&!is_half_float_type<T>::value>#
template<typenameT,typenameR=void>
usingenable_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.

constexprboolis_integer(Type::typetype_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

constexprboolis_signed_integer(Type::typetype_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

constexprboolis_unsigned_integer(Type::typetype_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

constexprboolis_floating(Type::typetype_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

constexprboolis_physical_floating(Type::typetype_id)#

Check for a physical floating point type.

This predicate matches floating-point types, except half-float.

constexprboolis_numeric(Type::typetype_id)#

Check for a numeric type.

This predicate doesn’t match decimals (seeis_decimal).

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a numeric type one

constexprboolis_decimal(Type::typetype_id)#

Check for a decimal type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a decimal type one

constexprboolis_run_end_type(Type::typetype_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

constexprboolis_primitive(Type::typetype_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

constexprboolis_base_binary_like(Type::typetype_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

constexprboolis_binary_like(Type::typetype_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

constexprboolis_large_binary_like(Type::typetype_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

constexprboolis_binary(Type::typetype_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

constexprboolis_binary_or_binary_view(Type::typetype_id)#

Check for a binary or binary view (non-string) type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a binary type one

constexprboolis_string(Type::typetype_id)#

Check for a string type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a string type one

constexprboolis_string_or_string_view(Type::typetype_id)#

Check for a string or string view type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a string type one

constexprboolis_binary_view_like(Type::typetype_id)#

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

string view and binary view)

Parameters:

type_id[in] the type-id to check

Returns:

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

constexprboolis_temporal(Type::typetype_id)#

Check for a temporal type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a temporal type one

constexprboolis_time(Type::typetype_id)#

Check for a time type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a primitive type one

constexprboolis_date(Type::typetype_id)#

Check for a date type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a primitive type one

constexprboolis_interval(Type::typetype_id)#

Check for an interval type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is an interval type one

constexprboolis_dictionary(Type::typetype_id)#

Check for a dictionary type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a dictionary type one

constexprboolis_fixed_size_binary(Type::typetype_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

constexprboolis_fixed_width(Type::typetype_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

constexprboolis_var_length_list(Type::typetype_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

constexprboolis_list(Type::typetype_id)#

Check for a list type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a list type one

constexprboolis_list_like(Type::typetype_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

constexprboolis_var_length_list_like(Type::typetype_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

constexprboolis_list_view(Type::typetype_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

constexprboolis_nested(Type::typetype_id)#

Check for a nested type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a nested type one

constexprboolis_union(Type::typetype_id)#

Check for a union type.

Parameters:

type_id[in] the type-id to check

Returns:

whether type-id is a union type one

constexprintbit_width(Type::typetype_id)#

Return the values bit width of a type.

ForType::FIXED_SIZE_BINARY, you will instead need to inspect the concreteDataType 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

constexprintoffset_bit_width(Type::typetype_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

intRequiredValueAlignmentForBuffer(Type::typetype_id,intbuffer_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)

constexprboolis_integer(constDataType&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

constexprboolis_signed_integer(constDataType&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

constexprboolis_unsigned_integer(constDataType&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

constexprboolis_floating(constDataType&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

constexprboolis_numeric(constDataType&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

constexprboolis_decimal(constDataType&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

constexprboolis_primitive(constDataType&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

constexprboolis_base_binary_like(constDataType&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

constexprboolis_binary_like(constDataType&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

constexprboolis_large_binary_like(constDataType&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

constexprboolis_binary(constDataType&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

constexprboolis_string(constDataType&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

constexprboolis_binary_view_like(constDataType&type)#

Check for a binary-view-like type.

Convenience for checking using the type’s id

Parameters:

type[in] the type to check

Returns:

whether type is a binary-view-like type

constexprboolis_temporal(constDataType&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

constexprboolis_interval(constDataType&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

constexprboolis_dictionary(constDataType&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

constexprboolis_fixed_size_binary(constDataType&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

constexprboolis_fixed_width(constDataType&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

constexprboolis_var_length_list(constDataType&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

constexprboolis_list_like(constDataType&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

constexprboolis_var_length_list_like(constDataType&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

constexprboolis_list_view(constDataType&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

constexprboolis_nested(constDataType&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

constexprboolis_union(constDataType&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

On this page