pitrou commented on code in PR #35794:
URL: https://github.com/apache/arrow/pull/35794#discussion_r1210613957
##########
cpp/src/arrow/datum.h:
##########
@@ -64,69 +68,102 @@ struct ARROW_EXPORT Datum {
Datum(Datum&& other) = default;
Datum& operator=(Datum&& other) = default;
+ /// \brief Construct from a Scalar
Datum(std::shared_ptr<Scalar> value) // NOLINT implicit conversion
: value(std::move(value)) {}
+ /// \brief Construct from an ArrayData
Datum(std::shared_ptr<ArrayData> value) // NOLINT implicit conversion
: value(std::move(value)) {}
+ /// \brief Construct from an ArrayData
Datum(ArrayData arg) // NOLINT implicit conversion
: value(std::make_shared<ArrayData>(std::move(arg))) {}
- Datum(const Array& value); // NOLINT implicit conversion
+ /// \brief Construct from an Array
+ Datum(const Array& value); // NOLINT implicit conversion
+
+ /// \brief Construct from an Array
Datum(const std::shared_ptr<Array>& value); // NOLINT implicit conversion
+
+ /// \brief Construct from a ChunkedArray
Datum(std::shared_ptr<ChunkedArray> value); // NOLINT implicit conversion
- Datum(std::shared_ptr<RecordBatch> value); // NOLINT implicit conversion
- Datum(std::shared_ptr<Table> value); // NOLINT implicit conversion
- // Explicit constructors from const-refs. Can be expensive, prefer the
- // shared_ptr constructors
+ /// \brief Construct from a RecordBatch
+ Datum(std::shared_ptr<RecordBatch> value); // NOLINT implicit conversion
+
+ /// \brief Construct from a Table
+ Datum(std::shared_ptr<Table> value); // NOLINT implicit conversion
+
+ /// \brief Construct from a ChunkedArray. Can be expensive, prefer the
+ /// shared_ptr constructor
explicit Datum(const ChunkedArray& value);
+
+ /// \brief Construct from a RecordBatch. Can be expensive, prefer the
+ /// shared_ptr constructor
explicit Datum(const RecordBatch& value);
+
+ /// \brief Construct from a Table. Can be expensive, prefer the
+ /// shared_ptr constructor
explicit Datum(const Table& value);
- // Cast from subtypes of Array or Scalar to Datum
+ /// \brief Cast from concrete types of Array or Scalar to Datum
template <typename T, bool IsArray = std::is_base_of_v<Array, T>,
bool IsScalar = std::is_base_of_v<Scalar, T>,
typename = enable_if_t<IsArray || IsScalar>>
Datum(std::shared_ptr<T> value) // NOLINT implicit conversion
: Datum(std::shared_ptr<typename std::conditional<IsArray, Array,
Scalar>::type>(
std::move(value))) {}
- // Cast from subtypes of Array or Scalar to Datum
+ /// \brief Cast from concrete types of Array or Scalar to Datum
template <typename T, typename TV = typename std::remove_reference_t<T>,
bool IsArray = std::is_base_of_v<Array, T>,
bool IsScalar = std::is_base_of_v<Scalar, T>,
typename = enable_if_t<IsArray || IsScalar>>
Datum(T&& value) // NOLINT implicit conversion
: Datum(std::make_shared<TV>(std::forward<T>(value))) {}
- // Many Scalars are copyable, let that happen
+ /// \brief Copy from concrete types of Scalar. The scalar type must copyable.
template <typename T, typename = enable_if_t<std::is_base_of_v<Scalar, T>>>
Datum(const T& value) // NOLINT implicit conversion
: Datum(std::make_shared<T>(value)) {}
// Convenience constructors
+ /// \brief A convenience constructor. Stores a bool scalar.
Review Comment:
```suggestion
/// \brief Convenience constructor storing a bool scalar.
```
--
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]