Copilot commented on code in PR #50270:
URL: https://github.com/apache/arrow/pull/50270#discussion_r3482189092


##########
cpp/src/arrow/compute/kernels/vector_sort_internal.h:
##########
@@ -780,14 +780,15 @@ struct ResolvedTableSortKey {
       // so we can't simply access the column from the table directly.
       ArrayVector chunks;
       chunks.reserve(batches.size());
+      auto physical_type = GetPhysicalType(f.type->GetSharedPtr());
       int64_t null_count = 0;
       for (const auto& batch : batches) {
         ARROW_ASSIGN_OR_RAISE(auto child, f.path.GetFlattened(*batch));
         null_count += child->null_count();
-        chunks.push_back(std::move(child));
+        chunks.push_back(GetPhysicalArray(*child, physical_type));
       }
 
-      return ResolvedTableSortKey(f.type->GetSharedPtr(), std::move(chunks), 
f.order,
+      return ResolvedTableSortKey(std::move(physical_type), std::move(chunks), 
f.order,
                                   f.null_placement, null_count);

Review Comment:
   `std::move(physical_type)` is misleading here: `ResolvedTableSortKey` takes 
the type as `const std::shared_ptr<DataType>&`, so the move has no effect (it 
just binds to a const reference). Dropping the move avoids suggesting ownership 
transfer that isn't happening (and makes it clearer that `physical_type` is 
reused for `GetPhysicalArray`).



-- 
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]

Reply via email to