@@ -402,7 +402,6 @@ async fn get_table(
402402 unimplemented ! ( "Invalid file format '{}'" , other) ;
403403 }
404404 } ;
405- let schema = Arc :: new ( get_tpch_table_schema ( table) ) ;
406405
407406 let options = ListingOptions :: new ( format)
408407 . with_file_extension ( extension)
@@ -412,10 +411,11 @@ async fn get_table(
412411 let table_path = ListingTableUrl :: parse ( path) ?;
413412 let config = ListingTableConfig :: new ( table_path) . with_listing_options ( options) ;
414413
415- let config = if table_format == "parquet" {
416- config. infer_schema ( & state) . await ?
417- } else {
418- config. with_schema ( schema)
414+ let config = match table_format {
415+ "parquet" => config. infer_schema ( & state) . await ?,
416+ "tbl" => config. with_schema ( Arc :: new ( get_tbl_tpch_table_schema ( table) ) ) ,
417+ "csv" => config. with_schema ( Arc :: new ( get_tpch_table_schema ( table) ) ) ,
418+ _ => unreachable ! ( ) ,
419419 } ;
420420
421421 Ok ( Arc :: new ( ListingTable :: try_new ( config) ?) )
@@ -827,6 +827,7 @@ mod tests {
827827#[ cfg( feature = "ci" ) ]
828828mod ci {
829829 use super :: * ;
830+ use arrow:: datatypes:: { DataType , Field } ;
830831 use datafusion_proto:: bytes:: { logical_plan_from_bytes, logical_plan_to_bytes} ;
831832
832833 async fn serde_round_trip ( query : usize ) -> Result < ( ) > {
@@ -1086,7 +1087,6 @@ mod ci {
10861087 /// * the correct number of rows are returned
10871088 /// * the content of the rows is correct
10881089 async fn verify_query ( n : usize ) -> Result < ( ) > {
1089- use datafusion:: arrow:: datatypes:: { DataType , Field } ;
10901090 use datafusion:: common:: ScalarValue ;
10911091 use datafusion:: logical_expr:: expr:: Cast ;
10921092
@@ -1214,7 +1214,8 @@ mod ci {
12141214 }
12151215
12161216 fn get_tpch_data_path ( ) -> Result < String > {
1217- let path = std:: env:: var ( "TPCH_DATA" ) . unwrap_or ( "benchmarks/data" . to_string ( ) ) ;
1217+ let path =
1218+ std:: env:: var ( "TPCH_DATA" ) . unwrap_or_else ( |_| "benchmarks/data" . to_string ( ) ) ;
12181219 if !Path :: new ( & path) . exists ( ) {
12191220 return Err ( DataFusionError :: Execution ( format ! (
12201221 "Benchmark data not found (set TPCH_DATA env var to override): {}" ,
0 commit comments