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

feat(parquet): introduce inverted index applier to reader #3130

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: use smallvec to reduce heap allocation
Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>
zhongzc committed Jan 11, 2024
commit 40550f4d7325b8f70d20a8a9880e72658e559e59
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -121,7 +121,7 @@ rskafka = "0.5"
rust_decimal = "1.33"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
smallvec = "1"
smallvec = { version = "1", features = ["serde"] }
snafu = "0.7"
# on branch v0.38.x
sqlparser = { git = "https://github.com/GreptimeTeam/sqlparser-rs.git", rev = "6a93567ae38d42be5c8d08b13c8ff4dde26502ef", features = [
2 changes: 1 addition & 1 deletion src/mito2/src/compaction/test_util.rs
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ pub fn new_file_handle(
),
level,
file_size: 0,
available_indexes: vec![],
available_indexes: Default::default(),
index_file_size: 0,
},
file_purger,
3 changes: 2 additions & 1 deletion src/mito2/src/compaction/twcs.rs
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ use common_telemetry::{debug, error, info};
use common_time::timestamp::TimeUnit;
use common_time::timestamp_millis::BucketAligned;
use common_time::Timestamp;
use smallvec::SmallVec;
use snafu::ResultExt;
use store_api::metadata::RegionMetadataRef;
use store_api::storage::RegionId;
@@ -332,7 +333,7 @@ impl TwcsCompactionTask {
file_size: sst_info.file_size,
available_indexes: sst_info
.inverted_index_available
.then(|| vec![IndexType::InvertedIndex])
.then(|| SmallVec::from_iter([IndexType::InvertedIndex]))
.unwrap_or_default(),
index_file_size: sst_info.index_file_size,
});
3 changes: 2 additions & 1 deletion src/mito2/src/flush.rs
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;

use common_telemetry::{error, info};
use smallvec::SmallVec;
use snafu::ResultExt;
use store_api::storage::RegionId;
use strum::IntoStaticStr;
@@ -341,7 +342,7 @@ impl RegionFlushTask {
file_size: sst_info.file_size,
available_indexes: sst_info
.inverted_index_available
.then(|| vec![IndexType::InvertedIndex])
.then(|| SmallVec::from_iter([IndexType::InvertedIndex]))
.unwrap_or_default(),
index_file_size: sst_info.index_file_size,
};
2 changes: 1 addition & 1 deletion src/mito2/src/manifest/tests/checkpoint.rs
Original file line number Diff line number Diff line change
@@ -171,7 +171,7 @@ async fn checkpoint_with_different_compression_types() {
time_range: (0.into(), 10000000.into()),
level: 0,
file_size: 1024000,
available_indexes: vec![],
available_indexes: Default::default(),
index_file_size: 0,
};
let action = RegionMetaActionList::new(vec![RegionMetaAction::Edit(RegionEdit {
8 changes: 5 additions & 3 deletions src/mito2/src/sst/file.rs
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ use std::sync::Arc;

use common_time::Timestamp;
use serde::{Deserialize, Serialize};
use smallvec::SmallVec;
use snafu::{ResultExt, Snafu};
use store_api::storage::RegionId;
use uuid::Uuid;
@@ -96,7 +97,7 @@ pub struct FileMeta {
/// Size of the file.
pub file_size: u64,
/// Available indexes of the file.
pub available_indexes: Vec<IndexType>,
pub available_indexes: SmallVec<[IndexType; 4]>,
/// Size of the index file.
pub index_file_size: u64,
}
@@ -252,7 +253,7 @@ mod tests {
time_range: FileTimeRange::default(),
level,
file_size: 0,
available_indexes: vec![],
available_indexes: SmallVec::from_iter([IndexType::InvertedIndex]),
index_file_size: 0,
}
}
@@ -268,7 +269,8 @@ mod tests {
#[test]
fn test_deserialize_from_string() {
let json_file_meta = "{\"region_id\":0,\"file_id\":\"bc5896ec-e4d8-4017-a80d-f2de73188d55\",\
\"time_range\":[{\"value\":0,\"unit\":\"Millisecond\"},{\"value\":0,\"unit\":\"Millisecond\"}],\"level\":0}";
\"time_range\":[{\"value\":0,\"unit\":\"Millisecond\"},{\"value\":0,\"unit\":\"Millisecond\"}],\
\"available_indexes\":[\"InvertedIndex\"],\"level\":0}";
let file_meta = create_file_meta(
FileId::from_str("bc5896ec-e4d8-4017-a80d-f2de73188d55").unwrap(),
0,
5 changes: 3 additions & 2 deletions src/mito2/src/sst/file_purger.rs
Original file line number Diff line number Diff line change
@@ -98,6 +98,7 @@ mod tests {
use common_test_util::temp_dir::create_temp_dir;
use object_store::services::Fs;
use object_store::ObjectStore;
use smallvec::SmallVec;

use super::*;
use crate::access_layer::AccessLayer;
@@ -132,7 +133,7 @@ mod tests {
time_range: FileTimeRange::default(),
level: 0,
file_size: 4096,
available_indexes: vec![],
available_indexes: Default::default(),
index_file_size: 0,
},
file_purger,
@@ -179,7 +180,7 @@ mod tests {
time_range: FileTimeRange::default(),
level: 0,
file_size: 4096,
available_indexes: vec![IndexType::InvertedIndex],
available_indexes: SmallVec::from_iter([IndexType::InvertedIndex]),
index_file_size: 4096,
},
file_purger,
2 changes: 1 addition & 1 deletion src/mito2/src/test_util/sst_util.rs
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ pub fn sst_file_handle(start_ms: i64, end_ms: i64) -> FileHandle {
),
level: 0,
file_size: 0,
available_indexes: vec![],
available_indexes: Default::default(),
index_file_size: 0,
},
file_purger,
4 changes: 2 additions & 2 deletions src/mito2/src/test_util/version_util.rs
Original file line number Diff line number Diff line change
@@ -96,7 +96,7 @@ impl VersionControlBuilder {
),
level: 0,
file_size: 0, // We don't care file size.
available_indexes: vec![],
available_indexes: Default::default(),
index_file_size: 0,
},
);
@@ -138,7 +138,7 @@ pub(crate) fn apply_edit(
),
level: 0,
file_size: 0, // We don't care file size.
available_indexes: vec![],
available_indexes: Default::default(),
index_file_size: 0,
}
})