pitrou commented on code in PR #13364:
URL: https://github.com/apache/arrow/pull/13364#discussion_r897145605
##########
cpp/src/arrow/type.h:
##########
@@ -174,6 +175,26 @@ class ARROW_EXPORT DataType : public
detail::Fingerprintable {
/// \brief Return the type category of the storage type
virtual Type::type storage_id() const { return id_; }
+ /// \brief Returns the type's fixed byte width, if any. Returns -1
+ /// for non-fixed-width types, and should only be used for
+ /// subclasses of FixedWidthType
+ virtual int32_t byte_width() const {
+ int32_t num_bits = this->bit_width();
+ return num_bits > 0 ? num_bits / 8 : -1;
+ }
+
+ /// \brief Returns the type's fixed bit width, if any. Returns -1
+ /// for non-fixed-width types, and should only be used for
+ /// subclasses of FixedWidthType
+ virtual int bit_width() const { return -1; }
+
+ // \brief EXPERIMENTAL: Enable retrieving shared_ptr<DataType> from a const
+ // context. Implementation requires enable_shared_from_this but we may fix
+ // this in the future
+ std::shared_ptr<DataType> Copy() const {
Review Comment:
Can we rename this as no copy is actually done?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]