diff --git a/cpp/src/arrow/compute/kernels/vector_array_sort.cc b/cpp/src/arrow/compute/kernels/vector_array_sort.cc index 1499554a960..b9cfd38a02a 100644 --- a/cpp/src/arrow/compute/kernels/vector_array_sort.cc +++ b/cpp/src/arrow/compute/kernels/vector_array_sort.cc @@ -262,6 +262,19 @@ class ArrayCompareSorter { } }; +template <> +class ArrayCompareSorter { + public: + Result operator()(uint64_t* indices_begin, uint64_t* indices_end, + const Array& array, int64_t offset, + const ArraySortOptions& options, + ExecContext* ctx) { + const auto& struct_array = checked_cast(array); + return SortStructArray(ctx, indices_begin, indices_end, struct_array, options.order, + options.null_placement); + } +}; + template class ArrayCountSorter { using ArrayType = typename TypeTraits::ArrayType; @@ -497,7 +510,7 @@ template struct ArraySorter< Type, enable_if_t::value || is_base_binary_type::value || is_fixed_size_binary_type::value || - is_dictionary_type::value>> { + is_dictionary_type::value || is_struct_type::value>> { ArrayCompareSorter impl; }; @@ -606,6 +619,13 @@ void AddDictArraySortingKernels(VectorKernel base, VectorFunction* func) { DCHECK_OK(func->AddKernel(base)); } +template