Skip to content

chore(query): fix location ver #14762

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

Merged
merged 2 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion src/query/storages/fuse/src/fuse_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,11 @@ impl FuseTable {
if let Some(loc) = &snapshot.table_statistics_location {
let reader = MetaReaders::table_snapshot_statistics_reader(self.get_operator());

let mut ver = TableMetaLocationGenerator::table_statistics_version(loc);
let load_params = LoadParams {
location: loc.clone(),
len_hint: None,
ver: TableMetaLocationGenerator::snapshot_statistics_version(),
ver,
put_cache: true,
};

Expand Down
17 changes: 13 additions & 4 deletions src/query/storages/fuse/src/io/locations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ static SNAPSHOT_V2: SnapshotVersion = SnapshotVersion::V2(PhantomData);
static SNAPSHOT_V3: SnapshotVersion = SnapshotVersion::V3(PhantomData);
static SNAPSHOT_V4: SnapshotVersion = SnapshotVersion::V4(PhantomData);

static SNAPSHOT_STATISTICS_V0: TableSnapshotStatisticsVersion =
TableSnapshotStatisticsVersion::V0(PhantomData);
static SNAPSHOT_STATISTICS_V2: TableSnapshotStatisticsVersion =
TableSnapshotStatisticsVersion::V2(PhantomData);

Expand Down Expand Up @@ -135,10 +137,6 @@ impl TableMetaLocationGenerator {
Ok(statistics_version.create(id, &self.prefix))
}

pub fn snapshot_statistics_version() -> u64 {
SNAPSHOT_STATISTICS_V2.version()
}

pub fn gen_last_snapshot_hint_location(&self) -> String {
format!("{}/{}", &self.prefix, FUSE_TBL_LAST_SNAPSHOT_HINT)
}
Expand All @@ -147,6 +145,17 @@ impl TableMetaLocationGenerator {
location.replace(FUSE_TBL_BLOCK_PREFIX, FUSE_TBL_VIRTUAL_BLOCK_PREFIX)
}

pub fn table_statistics_version(table_statistics_location: impl AsRef<str>) -> u64 {
if table_statistics_location
.as_ref()
.ends_with(SNAPSHOT_STATISTICS_V0.suffix().as_str())
{
SNAPSHOT_STATISTICS_V0.version()
} else {
SNAPSHOT_STATISTICS_V2.version()
}
}

pub fn gen_agg_index_location_from_block_location(loc: &str, index_id: u64) -> String {
let splits = loc.split('/').collect::<Vec<_>>();
let len = splits.len();
Expand Down