forked from databendlabs/databend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enable sort spilling when memory reach the limit. (databendlabs…
…#13989) * Add metrics for sort spill. * refactor: use builder pattern to build `TransformSortMerge(Limit)`. * Enable `TransformSortSpill`. * Ensure spill is activated. * Move sort spill test to stateless tests. * Fix bugs and test results. * Fix. * Fix tests. --------- Co-authored-by: sundyli <[email protected]>
- Loading branch information
1 parent
193ed56
commit e69c920
Showing
15 changed files
with
899 additions
and
353 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -14,7 +14,9 @@ | |
|
||
mod cursor; | ||
mod rows; | ||
mod spill; | ||
pub mod utils; | ||
|
||
pub use cursor::*; | ||
pub use rows::*; | ||
pub use spill::*; |
48 changes: 48 additions & 0 deletions
48
src/query/pipeline/transforms/src/processors/transforms/sort/spill.rs
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,48 @@ | ||
// Copyright 2021 Datafuse Labs | ||
// | ||
// 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. | ||
|
||
use common_expression::BlockMetaInfo; | ||
|
||
/// Mark a partially sorted [`DataBlock`] as a block needs to be spilled. | ||
#[derive(serde::Serialize, serde::Deserialize, Debug)] | ||
pub struct SortSpillMetaWithParams { | ||
pub batch_size: usize, | ||
pub num_merge: usize, | ||
} | ||
|
||
#[typetag::serde(name = "sort_spill")] | ||
impl BlockMetaInfo for SortSpillMetaWithParams { | ||
fn equals(&self, _: &Box<dyn BlockMetaInfo>) -> bool { | ||
unimplemented!("Unimplemented equals SortSpillMeta") | ||
} | ||
|
||
fn clone_self(&self) -> Box<dyn BlockMetaInfo> { | ||
unimplemented!("Unimplemented clone SortSpillMeta") | ||
} | ||
} | ||
|
||
/// Mark a partially sorted [`DataBlock`] as a block needs to be spilled. | ||
#[derive(serde::Serialize, serde::Deserialize, Debug)] | ||
pub struct SortSpillMeta {} | ||
|
||
#[typetag::serde(name = "sort_spill")] | ||
impl BlockMetaInfo for SortSpillMeta { | ||
fn equals(&self, _: &Box<dyn BlockMetaInfo>) -> bool { | ||
unimplemented!("Unimplemented equals SortSpillMeta") | ||
} | ||
|
||
fn clone_self(&self) -> Box<dyn BlockMetaInfo> { | ||
unimplemented!("Unimplemented clone SortSpillMeta") | ||
} | ||
} |
Oops, something went wrong.