@@ -94,36 +94,36 @@ mod tests {
9494
9595 use tempfile:: TempDir ;
9696
97- // #[tokio::test]
98- // async fn query_csv_with_custom_partition_extension() -> Result<()> {
99- // let tmp_dir = TempDir::new()?;
97+ #[ tokio:: test]
98+ async fn query_csv_with_custom_partition_extension ( ) -> Result < ( ) > {
99+ let tmp_dir = TempDir :: new ( ) ?;
100100
101- // // The main stipulation of this test: use a file extension that isn't .csv.
102- // let file_extension = ".tst";
101+ // The main stipulation of this test: use a file extension that isn't .csv.
102+ let file_extension = ".tst" ;
103103
104- // let ctx = SessionContext::new();
105- // let schema = populate_csv_partitions(&tmp_dir, 2, file_extension)?;
106- // ctx.register_csv(
107- // "test",
108- // tmp_dir.path().to_str().unwrap(),
109- // CsvReadOptions::new()
110- // .schema(&schema)
111- // .file_extension(file_extension),
112- // )
113- // .await?;
114- // let results =
115- // plan_and_collect(&ctx, "SELECT sum(c1), sum(c2), count(*) FROM test").await?;
104+ let ctx = SessionContext :: new ( ) ;
105+ let schema = populate_csv_partitions ( & tmp_dir, 2 , file_extension) ?;
106+ ctx. register_csv (
107+ "test" ,
108+ tmp_dir. path ( ) . to_str ( ) . unwrap ( ) ,
109+ CsvReadOptions :: new ( )
110+ . schema ( & schema)
111+ . file_extension ( file_extension) ,
112+ )
113+ . await ?;
114+ let results =
115+ plan_and_collect ( & ctx, "SELECT sum(c1), sum(c2), count(*) FROM test" ) . await ?;
116116
117- // assert_eq!(results.len(), 1);
118- // let expected = [
119- // "+--------------+--------------+----------+",
120- // "| sum(test.c1) | sum(test.c2) | count(*) |",
121- // "+--------------+--------------+----------+",
122- // "| 10 | 110 | 20 |",
123- // "+--------------+--------------+----------+",
124- // ];
125- // assert_batches_eq!(expected, &results);
117+ assert_eq ! ( results. len( ) , 1 ) ;
118+ let expected = [
119+ "+--------------+--------------+----------+" ,
120+ "| sum(test.c1) | sum(test.c2) | count(*) |" ,
121+ "+--------------+--------------+----------+" ,
122+ "| 10 | 110 | 20 |" ,
123+ "+--------------+--------------+----------+" ,
124+ ] ;
125+ assert_batches_eq ! ( expected, & results) ;
126126
127- // Ok(())
128- // }
127+ Ok ( ( ) )
128+ }
129129}
0 commit comments