jvanstraten commented on a change in pull request #12116:
URL: https://github.com/apache/arrow/pull/12116#discussion_r802807048
##########
File path: cpp/src/arrow/array/util.h
##########
@@ -37,7 +37,20 @@ namespace arrow {
ARROW_EXPORT
std::shared_ptr<Array> MakeArray(const std::shared_ptr<ArrayData>& data);
-/// \brief Create a strongly-typed Array instance with all elements null
+/// \brief Create a strongly-typed mutable Array instance with all elements
initially set
+/// to null
+/// \param[in] type the array type \param[in] length the array length
+/// \param[in] pool the memory pool to allocate memory from
+ARROW_EXPORT
+Result<std::shared_ptr<Array>> MakeMutableArrayOfNull(
+ const std::shared_ptr<DataType>& type, int64_t length,
+ MemoryPool* pool = default_memory_pool());
+
+/// \brief Create a strongly-typed immutable Array instance with all elements
null
+///
+/// This function may reuse a single zero buffer, but may also defer to
+/// MakeArrayOfNull().
Review comment:
Yeah, it was. I was on the fence about whether `MakeArrayOfNull()`
should be the immutable or mutable variant and refactored it once or twice,
eventually choosing the former since most existing users of the function didn't
need mutability. I guess that one slipped through the cracks. e878edb
##########
File path: cpp/src/arrow/array/util.h
##########
@@ -46,7 +59,20 @@ Result<std::shared_ptr<Array>> MakeArrayOfNull(const
std::shared_ptr<DataType>&
int64_t length,
MemoryPool* pool =
default_memory_pool());
-/// \brief Create an Array instance whose slots are the given scalar
+/// \brief Create a mutable Array instance whose slots are initialized with
the given
+/// scalar
+/// \param[in] scalar the value with which to fill the array
+/// \param[in] length the array length
+/// \param[in] pool the memory pool to allocate memory from
+ARROW_EXPORT
+Result<std::shared_ptr<Array>> MakeMutableArrayFromScalar(
+ const Scalar& scalar, int64_t length, MemoryPool* pool =
default_memory_pool());
+
+/// \brief Create an immutable Array instance whose slots are set to the given
scalar
+///
+/// This function may reuse buffers if they contain the same (repeated) value
to save
+/// memory, but may also defer to MakeArrayFromScalar().
Review comment:
Also in e878edb
--
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]