Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor] remove radix_sort #8891

Merged
merged 1 commit into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions be/src/runtime/mysql_table_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <mariadb/mysql.h>

#include <string_view>
#include <type_traits>
#include <variant>

#include "column/chunk.h"
Expand All @@ -33,7 +34,6 @@
#include "fmt/core.h"
#include "runtime/primitive_type.h"
#include "runtime/primitive_type_infra.h"
#include "util/radix_sort.h"

#define __StarRocksMysql MYSQL
#include <sstream>
Expand Down Expand Up @@ -130,7 +130,7 @@ Status MysqlTableWriter::_build_insert_sql(int from, int to, std::string_view* s
for (size_t col = 0; col < num_cols; col++) {
std::visit(
[&](auto&& viewer) {
using ViewerType = decay_t<decltype(viewer)>;
using ViewerType = std::decay_t<decltype(viewer)>;
constexpr PrimitiveType type = ViewerType::TYPE;

if (viewer.is_null(i)) {
Expand Down
303 changes: 0 additions & 303 deletions be/src/util/radix_sort.h

This file was deleted.

5 changes: 3 additions & 2 deletions be/src/util/tdigest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
#include <vector>

#include "common/logging.h"
#include "util/radix_sort.h"
#include "util/orlp/pdqsort.h"

namespace starrocks {

Expand Down Expand Up @@ -552,7 +552,8 @@ void TDigest::updateCumulative() {

void TDigest::process() {
CentroidComparator cc;
RadixSort<TDigestRadixSortTraits>::executeLSD(_unprocessed.data(), _unprocessed.size());
pdqsort(false, _unprocessed.begin(), _unprocessed.end(),
[&](auto& lhs, auto& rhs) { return lhs.mean() < rhs.mean(); });
auto count = _unprocessed.size();
_unprocessed.insert(_unprocessed.end(), _processed.cbegin(), _processed.cend());
std::inplace_merge(_unprocessed.begin(), _unprocessed.begin() + count, _unprocessed.end(), cc);
Expand Down
15 changes: 0 additions & 15 deletions be/src/util/tdigest.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
#include <vector>

#include "udf/udf.h"
#include "util/radix_sort.h"
#include "util/slice.h"

namespace starrocks {
Expand Down Expand Up @@ -101,20 +100,6 @@ struct CentroidComparator {
};

class TDigest {
struct TDigestRadixSortTraits {
using Element = Centroid;
using Key = Value;
using CountType = uint32_t;
using KeyBits = uint32_t;

static constexpr size_t PART_SIZE_BITS = 8;

using Transform = RadixSortFloatTransform<KeyBits>;
using Allocator = RadixSortMallocAllocator;

static Key& extractKey(Element& elem) { return elem.mean(); }
};

class TDigestComparator {
public:
TDigestComparator() = default;
Expand Down
1 change: 0 additions & 1 deletion be/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ set(EXEC_FILES
./util/path_trie_test.cpp
./util/path_util_test.cpp
./util/priority_queue_test.cpp
./util/radix_sort_test.cpp
./util/rle_encoding_test.cpp
./util/scoped_cleanup_test.cpp
./util/string_parser_test.cpp
Expand Down