Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions cpp/src/arrow/type.cc
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,16 @@ std::string TypeHolder::ToString(const std::vector<TypeHolder>& types) {

// ----------------------------------------------------------------------

FixedWidthType::~FixedWidthType() {}

PrimitiveCType::~PrimitiveCType() {}

NumberType::~NumberType() {}

IntegerType::~IntegerType() {}

FloatingPointType::~FloatingPointType() {}

FloatingPointType::Precision HalfFloatType::precision() const {
return FloatingPointType::HALF;
}
Expand All @@ -478,6 +488,12 @@ std::ostream& operator<<(std::ostream& os,
return os;
}

NestedType::~NestedType() {}

BaseBinaryType::~BaseBinaryType() {}

BaseListType::~BaseListType() {}

std::string ListType::ToString() const {
std::stringstream s;
s << "list<" << value_field()->ToString() << ">";
Expand Down Expand Up @@ -589,6 +605,8 @@ std::string FixedSizeBinaryType::ToString() const {
return ss.str();
}

TemporalType::~TemporalType() {}

// ----------------------------------------------------------------------
// Date types

Expand Down
27 changes: 27 additions & 0 deletions cpp/src/arrow/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,31 +288,46 @@ std::shared_ptr<DataType> GetPhysicalType(const std::shared_ptr<DataType>& type)
class ARROW_EXPORT FixedWidthType : public DataType {
public:
using DataType::DataType;
// This is only for preventing defining this class in each
// translation unit to avoid one-definition-rule violation.
~FixedWidthType() override;
};

/// \brief Base class for all data types representing primitive values
class ARROW_EXPORT PrimitiveCType : public FixedWidthType {
public:
using FixedWidthType::FixedWidthType;
// This is only for preventing defining this class in each
// translation unit to avoid one-definition-rule violation.
~PrimitiveCType() override;
};

/// \brief Base class for all numeric data types
class ARROW_EXPORT NumberType : public PrimitiveCType {
public:
using PrimitiveCType::PrimitiveCType;
// This is only for preventing defining this class in each
// translation unit to avoid one-definition-rule violation.
~NumberType() override;
};

/// \brief Base class for all integral data types
class ARROW_EXPORT IntegerType : public NumberType {
public:
using NumberType::NumberType;
// This is only for preventing defining this class in each
// translation unit to avoid one-definition-rule violation.
~IntegerType() override;
virtual bool is_signed() const = 0;
};

/// \brief Base class for all floating-point data types
class ARROW_EXPORT FloatingPointType : public NumberType {
public:
using NumberType::NumberType;
// This is only for preventing defining this class in each
// translation unit to avoid one-definition-rule violation.
~FloatingPointType() override;
enum Precision { HALF, SINGLE, DOUBLE };
virtual Precision precision() const = 0;
};
Expand All @@ -323,6 +338,9 @@ class ParametricType {};
class ARROW_EXPORT NestedType : public DataType, public ParametricType {
public:
using DataType::DataType;
// This is only for preventing defining this class in each
// translation unit to avoid one-definition-rule violation.
~NestedType() override;
};

/// \brief The combination of a field name and data type, with optional metadata
Expand Down Expand Up @@ -650,6 +668,9 @@ class ARROW_EXPORT DoubleType
class ARROW_EXPORT BaseBinaryType : public DataType {
public:
using DataType::DataType;
// This is only for preventing defining this class in each
// translation unit to avoid one-definition-rule violation.
~BaseBinaryType() override;
};

constexpr int64_t kBinaryMemoryLimit = std::numeric_limits<int32_t>::max() - 1;
Expand Down Expand Up @@ -893,6 +914,9 @@ class ARROW_EXPORT Decimal256Type : public DecimalType {
class ARROW_EXPORT BaseListType : public NestedType {
public:
using NestedType::NestedType;
// This is only for preventing defining this class in each
// translation unit to avoid one-definition-rule violation.
~BaseListType() override;
const std::shared_ptr<Field>& value_field() const { return children_[0]; }

std::shared_ptr<DataType> value_type() const { return children_[0]->type(); }
Expand Down Expand Up @@ -1209,6 +1233,9 @@ class ARROW_EXPORT DenseUnionType : public UnionType {
class ARROW_EXPORT TemporalType : public FixedWidthType {
public:
using FixedWidthType::FixedWidthType;
// This is only for preventing defining this class in each
// translation unit to avoid one-definition-rule violation.
~TemporalType() override;

DataTypeLayout layout() const override {
return DataTypeLayout(
Expand Down