benibus commented on code in PR #35197:
URL: https://github.com/apache/arrow/pull/35197#discussion_r1175671354
##########
cpp/src/arrow/type.cc:
##########
@@ -1328,20 +1363,54 @@ Result<std::shared_ptr<Array>> FieldPath::Get(const
Array& array) const {
Result<std::shared_ptr<ArrayData>> FieldPath::Get(const ArrayData& data) const
{
if (data.type->id() != Type::STRUCT) {
- return Status::NotImplemented("Get child data of non-struct array");
+ return FieldPathGetImpl::NonStructError();
}
return FieldPathGetImpl::Get(this, data.child_data);
}
Result<std::shared_ptr<ChunkedArray>> FieldPath::Get(
const ChunkedArray& chunked_array) const {
if (chunked_array.type()->id() != Type::STRUCT) {
- return Status::NotImplemented("Get child data of non-struct chunked
array");
+ return FieldPathGetImpl::NonStructError();
}
- auto columns = ChunkedArrayRef(chunked_array).Flatten();
+ auto columns = ChunkedArrayRef(chunked_array).FlattenZeroCopy();
return FieldPathGetImpl::Get(this, columns);
}
+Result<std::shared_ptr<Array>> FieldPath::GetFlattened(const Array& array)
const {
+ if (array.type_id() != Type::STRUCT) {
+ return FieldPathGetImpl::NonStructError();
+ }
+ auto&& struct_array = checked_cast<const StructArray&>(array);
Review Comment:
Equivalent to `const auto&` in this case, but yeah... probably less clear
and not exactly necessary (same for some of the test code).
--
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]