@@ -184,12 +184,16 @@ struct ARROW_EXPORT Field {
184184};
185185typedef std::shared_ptr<Field> FieldPtr;
186186
187+ struct PrimitiveCType : public DataType {
188+ using DataType::DataType;
189+ };
190+
187191template <typename DERIVED, Type::type TYPE_ID, typename C_TYPE>
188- struct ARROW_EXPORT PrimitiveCType : public DataType , public FixedWidthMeta {
192+ struct ARROW_EXPORT CTypeImpl : public PrimitiveCType , public FixedWidthMeta {
189193 using c_type = C_TYPE;
190194 static constexpr Type::type type_id = TYPE_ID;
191195
192- PrimitiveCType () : DataType (TYPE_ID) {}
196+ CTypeImpl () : PrimitiveCType (TYPE_ID) {}
193197
194198 int bit_width () const override { return sizeof (C_TYPE) * 8 ; }
195199
@@ -201,7 +205,7 @@ struct ARROW_EXPORT PrimitiveCType : public DataType, public FixedWidthMeta {
201205};
202206
203207struct ARROW_EXPORT NullType : public DataType, public FixedWidthMeta {
204- static constexpr Type::type type_enum = Type::NA;
208+ static constexpr Type::type type_id = Type::NA;
205209
206210 NullType () : DataType(Type::NA) {}
207211
@@ -213,13 +217,12 @@ struct ARROW_EXPORT NullType : public DataType, public FixedWidthMeta {
213217};
214218
215219template <typename DERIVED, Type::type TYPE_ID, typename C_TYPE>
216- struct IntegerTypeImpl : public PrimitiveCType <DERIVED, TYPE_ID, C_TYPE>,
217- public IntegerMeta {
220+ struct IntegerTypeImpl : public CTypeImpl <DERIVED, TYPE_ID, C_TYPE>, public IntegerMeta {
218221 bool is_signed () const override { return std::is_signed<C_TYPE>::value; }
219222};
220223
221224struct ARROW_EXPORT BooleanType : public DataType, FixedWidthMeta {
222- static constexpr Type::type type_enum = Type::BOOL;
225+ static constexpr Type::type type_id = Type::BOOL;
223226
224227 BooleanType () : DataType(Type::BOOL) {}
225228
@@ -266,25 +269,27 @@ struct ARROW_EXPORT Int64Type : public IntegerTypeImpl<Int64Type, Type::INT64, i
266269};
267270
268271struct ARROW_EXPORT HalfFloatType
269- : public PrimitiveCType <HalfFloatType, Type::HALF_FLOAT, uint16_t >,
272+ : public CTypeImpl <HalfFloatType, Type::HALF_FLOAT, uint16_t >,
270273 public FloatingPointMeta {
271274 Precision precision () const override ;
272275 static std::string name () { return " halffloat" ; }
273276};
274277
275- struct ARROW_EXPORT FloatType : public PrimitiveCType <FloatType, Type::FLOAT, float >,
278+ struct ARROW_EXPORT FloatType : public CTypeImpl <FloatType, Type::FLOAT, float >,
276279 public FloatingPointMeta {
277280 Precision precision () const override ;
278281 static std::string name () { return " float" ; }
279282};
280283
281- struct ARROW_EXPORT DoubleType : public PrimitiveCType <DoubleType, Type::DOUBLE, double >,
284+ struct ARROW_EXPORT DoubleType : public CTypeImpl <DoubleType, Type::DOUBLE, double >,
282285 public FloatingPointMeta {
283286 Precision precision () const override ;
284287 static std::string name () { return " double" ; }
285288};
286289
287290struct ARROW_EXPORT ListType : public DataType, public NoExtraMeta {
291+ static constexpr Type::type type_id = Type::LIST;
292+
288293 // List can contain any other logical value type
289294 explicit ListType (const std::shared_ptr<DataType>& value_type)
290295 : ListType(std::make_shared<Field>(" item" , value_type)) {}
@@ -305,6 +310,8 @@ struct ARROW_EXPORT ListType : public DataType, public NoExtraMeta {
305310
306311// BinaryType type is reprsents lists of 1-byte values.
307312struct ARROW_EXPORT BinaryType : public DataType, public NoExtraMeta {
313+ static constexpr Type::type type_id = Type::BINARY;
314+
308315 BinaryType () : BinaryType(Type::BINARY) {}
309316
310317 Status Accept (TypeVisitor* visitor) const override ;
@@ -318,6 +325,8 @@ struct ARROW_EXPORT BinaryType : public DataType, public NoExtraMeta {
318325
319326// UTF encoded strings
320327struct ARROW_EXPORT StringType : public BinaryType {
328+ static constexpr Type::type type_id = Type::STRING;
329+
321330 StringType () : BinaryType(Type::STRING) {}
322331
323332 Status Accept (TypeVisitor* visitor) const override ;
@@ -326,6 +335,8 @@ struct ARROW_EXPORT StringType : public BinaryType {
326335};
327336
328337struct ARROW_EXPORT StructType : public DataType, public NoExtraMeta {
338+ static constexpr Type::type type_id = Type::STRUCT;
339+
329340 explicit StructType (const std::vector<std::shared_ptr<Field>>& fields)
330341 : DataType(Type::STRUCT) {
331342 children_ = fields;
@@ -337,6 +348,8 @@ struct ARROW_EXPORT StructType : public DataType, public NoExtraMeta {
337348};
338349
339350struct ARROW_EXPORT DecimalType : public DataType {
351+ static constexpr Type::type type_id = Type::DECIMAL;
352+
340353 explicit DecimalType (int precision_, int scale_)
341354 : DataType(Type::DECIMAL), precision(precision_), scale(scale_) {}
342355 int precision;
@@ -350,6 +363,8 @@ struct ARROW_EXPORT DecimalType : public DataType {
350363enum class UnionMode : char { SPARSE, DENSE };
351364
352365struct ARROW_EXPORT UnionType : public DataType {
366+ static constexpr Type::type type_id = Type::UNION;
367+
353368 UnionType (const std::vector<std::shared_ptr<Field>>& child_fields,
354369 const std::vector<uint8_t >& type_ids, UnionMode mode = UnionMode::SPARSE)
355370 : DataType(Type::UNION), mode(mode), type_ids(type_ids) {
@@ -365,6 +380,8 @@ struct ARROW_EXPORT UnionType : public DataType {
365380};
366381
367382struct ARROW_EXPORT DateType : public DataType, public NoExtraMeta {
383+ static constexpr Type::type type_id = Type::DATE;
384+
368385 DateType () : DataType(Type::DATE) {}
369386
370387 Status Accept (TypeVisitor* visitor) const override ;
@@ -375,6 +392,7 @@ struct ARROW_EXPORT DateType : public DataType, public NoExtraMeta {
375392enum class TimeUnit : char { SECOND = 0 , MILLI = 1 , MICRO = 2 , NANO = 3 };
376393
377394struct ARROW_EXPORT TimeType : public DataType {
395+ static constexpr Type::type type_id = Type::TIME;
378396 using Unit = TimeUnit;
379397
380398 TimeUnit unit;
@@ -391,7 +409,7 @@ struct ARROW_EXPORT TimestampType : public DataType, public FixedWidthMeta {
391409 using Unit = TimeUnit;
392410
393411 typedef int64_t c_type;
394- static constexpr Type::type type_enum = Type::TIMESTAMP;
412+ static constexpr Type::type type_id = Type::TIMESTAMP;
395413
396414 int bit_width () const override { return sizeof (int64_t ) * 8 ; }
397415
@@ -411,7 +429,7 @@ struct ARROW_EXPORT IntervalType : public DataType, public FixedWidthMeta {
411429 enum class Unit : char { YEAR_MONTH = 0 , DAY_TIME = 1 };
412430
413431 typedef int64_t c_type;
414- static constexpr Type::type type_enum = Type::INTERVAL;
432+ static constexpr Type::type type_id = Type::INTERVAL;
415433
416434 int bit_width () const override { return sizeof (int64_t ) * 8 ; }
417435
0 commit comments