Skip to content

Commit

Permalink
chore: enable tests again
Browse files Browse the repository at this point in the history
  • Loading branch information
timvw committed Mar 26, 2024
1 parent 248b3fe commit c71df6c
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
use clap::Parser;
use datafusion::catalog::TableReference;
use std::sync::Arc;
//use datafusion::catalog::TableReference;

use datafusion::common::Result;
use datafusion::datasource::listing::{
ListingOptions, ListingTable, ListingTableConfig, ListingTableUrl,

Check failure on line 8 in src/main.rs

View workflow job for this annotation

GitHub Actions / cargo test

unused import: `ListingOptions`

Check failure on line 8 in src/main.rs

View workflow job for this annotation

GitHub Actions / cargo clippy

unused import: `ListingOptions`
};
use datafusion::prelude::*;

mod args;
Expand All @@ -23,9 +28,17 @@ async fn main() -> Result<()> {
//let globbing_path = args.get_globbing_path().await?;
//register_object_store(&ctx, &globbing_path.object_store_url).await?;

//let table_arc = build_table_provider(&ctx, &globbing_path, &args.at).await?;
//let table_ref = TableReference::full("datafusion", "public", "tbl");
//ctx.register_table(table_ref, table_arc)?;
let table_path = ListingTableUrl::parse(&args.path)?;
let mut config = ListingTableConfig::new(table_path);
config = config.infer_options(&ctx.state()).await?;
config = config.infer_schema(&ctx.state()).await?;

let table = ListingTable::try_new(config)?;

ctx.register_table(
TableReference::from("datafusion.public.tbl"),
Arc::new(table),
)?;

let query = &args.get_query();
let df = ctx.sql(query).await?;
Expand Down Expand Up @@ -61,7 +74,6 @@ mod tests {
Ok(())
}

/*
#[tokio::test]
async fn run_with_local_avro_file() -> Result<()> {
let mut cmd = get_qv_cmd()?;
Expand All @@ -70,14 +82,13 @@ mod tests {
.stdout(predicate::str::contains("| id | bool_col | tinyint_col | smallint_col | int_col | bigint_col | float_col | double_col | date_string_col | string_col | timestamp_col |"))
.stdout(predicate::str::contains("| 4 | true | 0 | 0 | 0 | 0 | 0.0 | 0.0 | 30332f30312f3039 | 30 | 2009-03-01T00:00:00 |"));
Ok(())
}*/
}

fn get_qv_testing_path(rel_data_path: &str) -> String {
let testing_path = env::var("QV_TESTING_PATH").unwrap_or_else(|_| "./testing".to_string());
format!("{}/{}", testing_path, rel_data_path)
}

/*
#[tokio::test]
async fn run_with_local_parquet_file() -> Result<()> {
let mut cmd = get_qv_cmd()?;
Expand All @@ -93,5 +104,5 @@ mod tests {
r#"| {reply_id: 332770973, next_id: } | -1473106667809783919 |"#,
));
Ok(())
}*/
}
}

0 comments on commit c71df6c

Please sign in to comment.