Skip to content

Commit f552c27

Browse files
Removed unnecessary enum
1 parent 9e3667e commit f552c27

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

asap-planner-rs/src/main.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use asap_planner::{Controller, RuntimeOptions, SQLController, SQLRuntimeOptions, StreamingEngine};
22
use clap::Parser;
3+
use sketch_db_common::enums::QueryLanguage;
34
use std::path::PathBuf;
45

56
#[derive(Parser, Debug)]
@@ -27,7 +28,7 @@ struct Args {
2728
step: u64,
2829

2930
#[arg(long = "query-language", value_enum, default_value = "promql")]
30-
query_language: QueryLanguageArg,
31+
query_language: QueryLanguage,
3132

3233
#[arg(long = "data-ingestion-interval", required = false)]
3334
data_ingestion_interval: Option<u64>,
@@ -42,12 +43,6 @@ enum EngineArg {
4243
Flink,
4344
}
4445

45-
#[derive(clap::ValueEnum, Debug, Clone, Copy)]
46-
enum QueryLanguageArg {
47-
Promql,
48-
Sql,
49-
}
50-
5146
fn main() -> anyhow::Result<()> {
5247
let args = Args::parse();
5348

@@ -65,7 +60,7 @@ fn main() -> anyhow::Result<()> {
6560
};
6661

6762
match args.query_language {
68-
QueryLanguageArg::Promql => {
63+
QueryLanguage::promql => {
6964
let scrape_interval = args.prometheus_scrape_interval.ok_or_else(|| {
7065
anyhow::anyhow!("--prometheus_scrape_interval is required for PromQL mode")
7166
})?;
@@ -79,7 +74,7 @@ fn main() -> anyhow::Result<()> {
7974
let controller = Controller::from_file(&args.input_config, opts)?;
8075
controller.generate_to_dir(&args.output_dir)?;
8176
}
82-
QueryLanguageArg::Sql => {
77+
QueryLanguage::sql | QueryLanguage::elastic_sql => {
8378
let interval = args.data_ingestion_interval.ok_or_else(|| {
8479
anyhow::anyhow!("--data-ingestion-interval is required for SQL mode")
8580
})?;
@@ -91,6 +86,9 @@ fn main() -> anyhow::Result<()> {
9186
SQLController::from_file(&args.input_config, opts)?
9287
.generate_to_dir(&args.output_dir)?;
9388
}
89+
QueryLanguage::elastic_querydsl => {
90+
anyhow::bail!("ElasticQueryDSL is not yet supported");
91+
}
9492
}
9593

9694
println!("Generated configs in {}", args.output_dir.display());

0 commit comments

Comments
 (0)