lidavidm commented on code in PR #35098:
URL: https://github.com/apache/arrow/pull/35098#discussion_r1166390730
##########
cpp/src/arrow/array/data.cc:
##########
@@ -144,6 +144,8 @@ std::shared_ptr<ArrayData> ArrayData::Slice(int64_t off,
int64_t len) const {
} else {
copy->null_count = null_count != 0 ? kUnknownNullCount : 0;
}
+ for (auto& child : copy->child_data)
+ child = child->Slice(copy->offset, copy->length);
Review Comment:
Yes, the expectation *in the C++ implementation* is that slicing an array is
a metadata-only operation that just adjusts the "offset" of an array, and does
not affect child arrays. That means code directly manipulating child arrays
must (recursively) account for parent array offsets.
However, it may be good to document how to 'materialize' or slice the child
array(s) to account for this. I'm not aware of a convenient way to do this.
--
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]