Skip to content

Commit

Permalink
Type id fix
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Chigarev <[email protected]>
  • Loading branch information
dchigarev committed Oct 9, 2020
1 parent 4b87148 commit c64085e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions cpp/src/arrow/type.cc
Original file line number Diff line number Diff line change
Expand Up @@ -753,9 +753,12 @@ std::vector<std::shared_ptr<Field>> StructType::GetAllFieldsByName(
template<uint32_t width>
struct DecimalTypeHelper;

#define DECIMAL_TYPE_HELPER_DECL(width) \
template<> \
struct DecimalTypeHelper<width> { using type = Decimal##width##Type; };
#define DECIMAL_TYPE_HELPER_DECL(width) \
template<> \
struct DecimalTypeHelper<width> { \
static constexpr Type::type id = Type::DECIMAL##width; \
using type = Decimal##width##Type; \
};

DECIMAL_TYPE_HELPER_DECL(128)
DECIMAL_TYPE_HELPER_DECL(256)
Expand All @@ -765,7 +768,7 @@ DECIMAL_TYPE_HELPER_DECL(256)

template<uint32_t width>
BaseDecimalType<width>::BaseDecimalType(int32_t precision, int32_t scale)
: DecimalType(type_id, (width >> 3), precision, scale) {
: DecimalType(DecimalTypeHelper<width>::id, (width >> 3), precision, scale) {
ARROW_CHECK_GE(precision, kMinPrecision);
ARROW_CHECK_LE(precision, kMaxPrecision);
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ class ARROW_EXPORT DecimalType : public FixedSizeBinaryType {

/// \brief Template type class for decimal data
template<uint32_t width>
class ARROW_EXPORT BaseDecimalType : public DecimalType {
class BaseDecimalType : public DecimalType {
public:
static constexpr const char* type_name() { return DecimalMeta<width>::name; }

Expand Down

0 comments on commit c64085e

Please sign in to comment.