viirya commented on code in PR #6: URL: https://github.com/apache/datafusion-benchmarks/pull/6#discussion_r1673251708
########## runners/datafusion-rust/src/main.rs: ########## @@ -0,0 +1,291 @@ +use datafusion::common::Result; +use datafusion::dataframe::DataFrameWriteOptions; +use datafusion::datasource::MemTable; +use datafusion::physical_plan::displayable; +use datafusion::prelude::{ParquetReadOptions, SessionConfig, SessionContext}; +use datafusion::scalar::ScalarValue; +use datafusion::DATAFUSION_VERSION; +use serde::Serialize; +use std::collections::HashMap; +use std::fs; +use std::fs::File; +use std::io::{BufRead, BufReader, BufWriter, Write}; +use std::path::{Path, PathBuf}; +use std::sync::Arc; +use std::time::{SystemTime, UNIX_EPOCH}; +use structopt::StructOpt; +use tokio::time::Instant; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + /// Activate debug mode + #[structopt(long)] + debug: bool, + + /// Optional path to config file + #[structopt(short, long, parse(from_os_str))] + config_path: Option<PathBuf>, + + /// Path to queries + #[structopt(long, parse(from_os_str))] + query_path: PathBuf, + + /// Path to data + #[structopt(short, long, parse(from_os_str))] + data_path: PathBuf, + + /// Output path + #[structopt(short, long, parse(from_os_str))] + output: PathBuf, + + /// Query number. If no query number specified then all queries will be executed. + #[structopt(short, long)] + query: Option<u8>, + + /// Number of queries in this benchmark suite + #[structopt(short, long)] + num_queries: Option<u8>, + + /// List of queries to exclude + #[structopt(short, long)] + exclude: Vec<u8>, + + /// Concurrency + #[structopt(short, long)] + concurrency: u8, + + /// Iterations (number of times to run each query) + #[structopt(short, long)] + iterations: u8, +} + +#[derive(Debug, PartialEq, Serialize, Default)] +pub struct Results { + system_time: u128, + datafusion_version: String, + config: HashMap<String, String>, + command_line_args: Vec<String>, + register_tables_time: u128, + /// Vector of (query_number, query_times) + query_times: Vec<(u8, Vec<u128>)>, +} + +impl Results { + fn new() -> Self { + let current_time = SystemTime::now() + .duration_since(UNIX_EPOCH) + .expect("Time went backwards"); + Self { + system_time: current_time.as_millis(), + datafusion_version: DATAFUSION_VERSION.to_string(), + config: HashMap::new(), + command_line_args: vec![], + register_tables_time: 0, + query_times: vec![], + } + } +} + +#[tokio::main] +pub async fn main() -> Result<()> { + let mut results = Results::new(); + for arg in std::env::args() { + results.command_line_args.push(arg); Review Comment: Do we use this `command_line_args` later? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org