pitrou commented on a change in pull request #7507:
URL: https://github.com/apache/arrow/pull/7507#discussion_r577000812
##########
File path: cpp/src/arrow/array/util.cc
##########
@@ -74,11 +75,222 @@ class ArrayDataWrapper {
std::shared_ptr<Array>* out_;
};
+class ArrayDataEndianSwapper {
+ public:
+ ArrayDataEndianSwapper(const std::shared_ptr<ArrayData>& data, int64_t
length)
+ : data_(data), length_(length) {
+ const std::shared_ptr<DataType>& type = data->type;
+ std::vector<std::shared_ptr<Buffer>> buffers(data->buffers.size(),
nullptr);
+ std::vector<std::shared_ptr<ArrayData>>
child_data(data->child_data.size(), nullptr);
+ out_ = ArrayData::Make(type, data->length, buffers, child_data,
data->null_count, 0);
+ }
+
+ Status SwapType(const DataType& type) {
+ RETURN_NOT_OK(VisitTypeInline(type, this));
+ RETURN_NOT_OK(SwapChildren(type.fields()));
+ return Status::OK();
+ }
+
+ Status SwapChildren(const std::vector<std::shared_ptr<Field>>& child_fields)
{
Review comment:
I think you can write `const FieldVector& child_fields`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]