pitrou commented on a change in pull request #11798:
URL: https://github.com/apache/arrow/pull/11798#discussion_r761892748
##########
File path: cpp/src/arrow/chunked_array.h
##########
@@ -89,6 +89,17 @@ class ARROW_EXPORT ChunkedArray {
static Result<std::shared_ptr<ChunkedArray>> Make(
ArrayVector chunks, std::shared_ptr<DataType> type = NULLPTR);
+ /// \brief Create an empty ChunkedArray of a given type
+ ///
+ /// The output ChunkedArray will have one chunk with an empty
+ /// array of the given type.
+ ///
+ /// \param[in] type DataType of the empty ChunkedArray
+ /// \param[in] memory_pool MemoryPool pointer
+ /// \return the resulting ChunkedArray
+ static Result<std::shared_ptr<ChunkedArray>> MakeEmptyChunkedArray(
Review comment:
Either make this a top-level `MakeEmptyChunkedArray` function, or rename
it to `ChunkedArray::MakeEmpty`.
##########
File path: cpp/src/arrow/record_batch.h
##########
@@ -60,6 +60,17 @@ class ARROW_EXPORT RecordBatch {
std::shared_ptr<Schema> schema, int64_t num_rows,
std::vector<std::shared_ptr<ArrayData>> columns);
+ /// \brief Create an empty RecordBatch of a given schema
+ ///
+ /// The output RecordBatch will be created with DataTypes from
+ /// the given schema.
+ ///
+ /// \param[in] schema Schema of the empty RecordBatch
+ /// \param[in] memory_pool MemoryPool pointer
+ /// \return the resulting RecordBatch
+ static Result<std::shared_ptr<RecordBatch>> MakeEmptyRecordBatch(
+ std::shared_ptr<Schema> schema, MemoryPool* memory_pool);
Review comment:
Same suggestion as for `ChunkedArray`: make it a top-level function, or
rename it.
##########
File path: cpp/src/arrow/compute/kernels/util_internal.h
##########
@@ -23,8 +23,11 @@
#include "arrow/array/util.h"
#include "arrow/buffer.h"
+#include "arrow/chunked_array.h"
#include "arrow/compute/kernels/codegen_internal.h"
#include "arrow/compute/type_fwd.h"
+#include "arrow/record_batch.h"
+#include "arrow/table.h"
Review comment:
Can you remove these includes now? They're not needed anymore.
##########
File path: cpp/src/arrow/table.h
##########
@@ -63,6 +63,17 @@ class ARROW_EXPORT Table {
const
std::vector<std::shared_ptr<Array>>& arrays,
int64_t num_rows = -1);
+ /// \brief Create an empty Table of a given schema
+ ///
+ /// The output Table will be created from a ChunkedArrayVector
+ /// with DataTypes from the schema.
+ ///
+ /// \param[in] schema Schema of the empty Table
+ /// \param[in] memory_pool MemoryPool pointer
+ /// \return the resulting Table
+ static Result<std::shared_ptr<Table>> MakeEmptyTable(std::shared_ptr<Schema>
schema,
Review comment:
And same suggestion here :-)
--
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]