Skip to content

Commit 9008046

Browse files
committed
use TypeClass::c_type
1 parent e46b0d8 commit 9008046

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

cpp/src/arrow/types/primitive.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ class ARROW_EXPORT PrimitiveArray : public Array {
5353
const uint8_t* raw_data_;
5454
};
5555

56-
template <class TypeClass, class T>
56+
template <class TypeClass>
5757
class ARROW_EXPORT NumericArray : public PrimitiveArray {
5858
public:
59-
using value_type = T;
59+
using value_type = typename TypeClass::c_type;
6060
NumericArray(int32_t length, const std::shared_ptr<Buffer>& data,
6161
int32_t null_count = 0, const std::shared_ptr<Buffer>& null_bitmap = nullptr)
6262
: PrimitiveArray(
@@ -65,7 +65,7 @@ class ARROW_EXPORT NumericArray : public PrimitiveArray {
6565
int32_t null_count = 0, const std::shared_ptr<Buffer>& null_bitmap = nullptr)
6666
: PrimitiveArray(type, length, data, null_count, null_bitmap) {}
6767

68-
bool EqualsExact(const NumericArray<TypeClass, T>& other) const {
68+
bool EqualsExact(const NumericArray<TypeClass>& other) const {
6969
return PrimitiveArray::EqualsExact(*static_cast<const PrimitiveArray*>(&other));
7070
}
7171

@@ -74,7 +74,7 @@ class ARROW_EXPORT NumericArray : public PrimitiveArray {
7474
if (this == arr.get()) { return true; }
7575
if (!arr) { return false; }
7676
if (this->type_enum() != arr->type_enum()) { return false; }
77-
const auto other = static_cast<NumericArray<TypeClass, T>*>(arr.get());
77+
const auto other = static_cast<NumericArray<TypeClass>*>(arr.get());
7878
for (int32_t i = start_idx, o_i = other_start_idx; i < end_idx; ++i, ++o_i) {
7979
const bool is_null = IsNull(i);
8080
if (is_null != arr->IsNull(o_i) || (!is_null && Value(i) != other->Value(o_i))) {
@@ -83,23 +83,23 @@ class ARROW_EXPORT NumericArray : public PrimitiveArray {
8383
}
8484
return true;
8585
}
86-
const T* raw_data() const { return reinterpret_cast<const T*>(raw_data_); }
86+
const value_type* raw_data() const { return reinterpret_cast<const value_type*>(raw_data_); }
8787

88-
T Value(int i) const { return raw_data()[i]; }
88+
value_type Value(int i) const { return raw_data()[i]; }
8989
};
9090

91-
#define NUMERIC_ARRAY_DECL(NAME, TypeClass, T) using NAME = NumericArray<TypeClass, T>;
92-
93-
NUMERIC_ARRAY_DECL(UInt8Array, UInt8Type, uint8_t);
94-
NUMERIC_ARRAY_DECL(Int8Array, Int8Type, int8_t);
95-
NUMERIC_ARRAY_DECL(UInt16Array, UInt16Type, uint16_t);
96-
NUMERIC_ARRAY_DECL(Int16Array, Int16Type, int16_t);
97-
NUMERIC_ARRAY_DECL(UInt32Array, UInt32Type, uint32_t);
98-
NUMERIC_ARRAY_DECL(Int32Array, Int32Type, int32_t);
99-
NUMERIC_ARRAY_DECL(UInt64Array, UInt64Type, uint64_t);
100-
NUMERIC_ARRAY_DECL(Int64Array, Int64Type, int64_t);
101-
NUMERIC_ARRAY_DECL(FloatArray, FloatType, float);
102-
NUMERIC_ARRAY_DECL(DoubleArray, DoubleType, double);
91+
#define NUMERIC_ARRAY_DECL(NAME, TypeClass) using NAME = NumericArray<TypeClass>;
92+
93+
NUMERIC_ARRAY_DECL(UInt8Array, UInt8Type);
94+
NUMERIC_ARRAY_DECL(Int8Array, Int8Type);
95+
NUMERIC_ARRAY_DECL(UInt16Array, UInt16Type);
96+
NUMERIC_ARRAY_DECL(Int16Array, Int16Type);
97+
NUMERIC_ARRAY_DECL(UInt32Array, UInt32Type);
98+
NUMERIC_ARRAY_DECL(Int32Array, Int32Type);
99+
NUMERIC_ARRAY_DECL(UInt64Array, UInt64Type);
100+
NUMERIC_ARRAY_DECL(Int64Array, Int64Type);
101+
NUMERIC_ARRAY_DECL(FloatArray, FloatType);
102+
NUMERIC_ARRAY_DECL(DoubleArray, DoubleType);
103103

104104
template <typename Type>
105105
class ARROW_EXPORT PrimitiveBuilder : public ArrayBuilder {

0 commit comments

Comments
 (0)