Describe the enhancement requested
In visit_type_inline.h we have a VisitType that dispatches all existing data types to a generic callable (presumably a lambda or template function).
It would be useful to have a similar VisitIntegerType helper that assumes its input is an integer type. This would help implementing helpers for dictionary indices, take indices, etc.
For example this snippet could be reimplemented more tersely using said helper:
|
const auto& dict_array_type = internal::checked_cast<const DictionaryType&>(*span.type); |
|
switch (dict_array_type.index_type()->id()) { |
|
case Type::UINT8: |
|
return LogicalNullCount<UInt8Type>(span); |
|
case Type::INT8: |
|
return LogicalNullCount<Int8Type>(span); |
|
case Type::UINT16: |
|
return LogicalNullCount<UInt16Type>(span); |
|
case Type::INT16: |
|
return LogicalNullCount<Int16Type>(span); |
|
case Type::UINT32: |
|
return LogicalNullCount<UInt32Type>(span); |
|
case Type::INT32: |
|
return LogicalNullCount<Int32Type>(span); |
|
case Type::UINT64: |
|
return LogicalNullCount<UInt64Type>(span); |
|
default: |
|
return LogicalNullCount<Int64Type>(span); |
|
} |
Component(s)
C++
Describe the enhancement requested
In
visit_type_inline.hwe have aVisitTypethat dispatches all existing data types to a generic callable (presumably a lambda or template function).It would be useful to have a similar
VisitIntegerTypehelper that assumes its input is an integer type. This would help implementing helpers for dictionary indices, take indices, etc.For example this snippet could be reimplemented more tersely using said helper:
arrow/cpp/src/arrow/util/dict_util.cc
Lines 61 to 79 in 154962c
Component(s)
C++