wgtmac commented on code in PR #34691:
URL: https://github.com/apache/arrow/pull/34691#discussion_r1145581071
##########
cpp/src/arrow/record_batch.cc:
##########
@@ -198,14 +198,20 @@ Result<std::shared_ptr<RecordBatch>>
RecordBatch::MakeEmpty(
}
Result<std::shared_ptr<RecordBatch>> RecordBatch::FromStructArray(
- const std::shared_ptr<Array>& array) {
+ const std::shared_ptr<Array>& array, MemoryPool* memory_pool) {
if (array->type_id() != Type::STRUCT) {
return Status::TypeError("Cannot construct record batch from array of type
",
*array->type());
}
- if (array->null_count() != 0) {
- return Status::Invalid(
- "Unable to construct record batch from a StructArray with non-zero
nulls.");
+ if (array->null_count() != 0 || array->offset() != 0) {
+ // If the struct array has a validity map or offset we need to push those
into
Review Comment:
If the struct_array only has an offset (w/o validity map), does
`struct_array->Slice(offset, length)` work as well which should be zero copy?
--
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]