-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: min/max消除, top n * feat: support distinct count(*) * feat: like to range * feat: bit type transfer to int * feat: add json type * fix: float & double返回值精度同to_string函数 * fix: agg return 0 when result empty * feat: 可动态修改user quota * feat: agg没有聚合函数时支持limit * fix: rollbak send binlog coredump * fix: prepare 不支持full_export * feat: store health check get old status when update * fix: cstore + ttl + separate乱码问题
- Loading branch information
Showing
35 changed files
with
725 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright (c) 2018-present Baidu, Inc. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#pragma once | ||
|
||
#include <algorithm> | ||
#include <vector> | ||
#include "common.h" | ||
#include "row_batch.h" | ||
#include "mem_row_compare.h" | ||
#include "sorter.h" | ||
|
||
namespace baikaldb { | ||
//对每个batch并行的做sort后,再用heap做归并 | ||
|
||
struct TopNHeapItem { | ||
std::unique_ptr<baikaldb::MemRow> row; | ||
int64_t idx; | ||
}; | ||
|
||
class TopNSorter : public Sorter { | ||
public: | ||
TopNSorter(MemRowCompare* comp, int64_t limit) : Sorter(comp), _limit(limit) { | ||
} | ||
virtual void add_batch(std::shared_ptr<RowBatch>& batch); | ||
virtual void sort(); | ||
virtual void merge_sort(){} | ||
virtual int get_next(RowBatch* batch, bool* eos); | ||
private: | ||
virtual void shiftdown(size_t index); | ||
virtual void shiftup(size_t index); | ||
|
||
private: | ||
std::vector<TopNHeapItem> _mem_row_heap; | ||
int64_t _limit = -1; | ||
int64_t _current_count = 0; | ||
int64_t _current_idx = 0; | ||
}; | ||
} | ||
|
||
/* vim: set ts=4 sw=4 sts=4 tw=100 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.