Skip to content

Commit

Permalink
feat: sst-metadata support sort
Browse files Browse the repository at this point in the history
  • Loading branch information
jiacai2050 committed Jun 29, 2023
1 parent 3c113b5 commit fdb59ce
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion tools/src/bin/sst-metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

//! A cli to query sst meta data

use std::{collections::HashMap, sync::Arc};
use std::{collections::HashMap, fmt, str::FromStr, sync::Arc};

use analytic_engine::sst::{meta_data::cache::MetaData, parquet::async_reader::ChunkReaderAdapter};
use anyhow::{Context, Result};
Expand Down Expand Up @@ -34,6 +34,31 @@ struct Args {
/// Print page indexes
#[clap(short, long, required(false))]
page_indexes: bool,

/// Which field to sort ssts.
#[clap(short, long, default_value_t=SortBy::Time)]
sort: SortBy,
}

#[derive(Debug)]
enum SortBy {
Seq,
Time,
Size,
}

impl fmt::Display for SortBy {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", self)
}
}

impl FromStr for SortBy {
type Err = String;

fn from_str(s: &str) -> Result<Self, Self::Err> {
todo!()
}
}

#[derive(Default, Debug)]
Expand Down

0 comments on commit fdb59ce

Please sign in to comment.