Skip to content

Commit

Permalink
Fixed code review issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kitaisreal committed Jan 30, 2024
1 parent 948f3f1 commit 1c5b377
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/AggregateFunctions/AggregateFunctionGroupArraySorted.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,15 @@ struct GroupArraySortedData
ALWAYS_INLINE void sortAndLimit(size_t max_elements, Arena * arena)
{
if constexpr (is_value_generic_field)
{
::sort(values.begin(), values.end(), Comparator());
}
else
RadixSort<RadixSortNumTraits<T>>::executeLSD(values.data(), values.size());
{
bool is_sorted = trySort(values.begin(), values.end(), Comparator());
if (!is_sorted)
RadixSort<RadixSortNumTraits<T>>::executeLSD(values.data(), values.size());
}

if (values.size() > max_elements)
values.resize(max_elements, arena);
Expand Down
4 changes: 2 additions & 2 deletions src/AggregateFunctions/examples/group_array_sorted.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ int main(int argc, char ** argv)
}

std::string method = std::string(argv[1]);
uint64_t elements = std::atol(argv[2]);
uint64_t max_elements = std::atol(argv[3]);
uint64_t elements = std::atol(argv[2]); /// NOLINT
uint64_t max_elements = std::atol(argv[3]); /// NOLINT

std::cerr << "Method " << method << " elements " << elements << " max elements " << max_elements << '\n';

Expand Down

0 comments on commit 1c5b377

Please sign in to comment.