kiszk commented on a change in pull request #7507:
URL: https://github.com/apache/arrow/pull/7507#discussion_r532819514
##########
File path: cpp/src/arrow/array/util.cc
##########
@@ -74,6 +75,204 @@ class ArrayDataWrapper {
std::shared_ptr<Array>* out_;
};
+class ArrayDataEndianSwapper {
+ public:
+ ArrayDataEndianSwapper(std::shared_ptr<ArrayData>& data, int64_t length)
+ : data_(data), length_(length) {}
+
+ Status SwapType(const DataType& type) {
+ RETURN_NOT_OK(VisitTypeInline(type, this));
+ RETURN_NOT_OK(SwapChildren(type.fields()));
+ return Status::OK();
+ }
+
+ Status SwapChildren(std::vector<std::shared_ptr<Field>> child_fields) {
+ int i = 0;
+ for (const auto& child_field : child_fields) {
+ ArrayDataEndianSwapper swapper_child_visitor(data_->child_data[i],
+
data_->child_data[i]->length);
+ RETURN_NOT_OK(VisitTypeInline(*child_field.get()->type(),
&swapper_child_visitor));
+ RETURN_NOT_OK(
+
swapper_child_visitor.SwapChildren((*child_field.get()->type()).fields()));
+ i++;
Review comment:
I need to add an additional argument to `SwapEndianArrayData` since
`data->child_data[i]` is passed to `ArrayDataEndianSwapper`. I will do that.
----------------------------------------------------------------
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]