@@ -264,125 +264,124 @@ mod test {
264
264
use super :: * ;
265
265
use datafusion:: physical_plan:: displayable;
266
266
use datafusion:: prelude:: { ParquetReadOptions , SessionConfig , SessionContext } ;
267
- use std :: fs ;
267
+ use pretty_assertions :: assert_eq ;
268
268
use std:: path:: Path ;
269
+ use std:: { env, fs} ;
270
+ type TestResult < T > = std:: result:: Result < T , anyhow:: Error > ;
269
271
270
272
#[ tokio:: test]
271
- async fn test_q1 ( ) -> Result < ( ) > {
273
+ async fn test_q1 ( ) -> TestResult < ( ) > {
272
274
do_test ( 1 ) . await
273
275
}
274
276
275
277
#[ tokio:: test]
276
- async fn test_q2 ( ) -> Result < ( ) > {
278
+ async fn test_q2 ( ) -> TestResult < ( ) > {
277
279
do_test ( 2 ) . await
278
280
}
279
281
280
282
#[ tokio:: test]
281
- async fn test_q3 ( ) -> Result < ( ) > {
283
+ async fn test_q3 ( ) -> TestResult < ( ) > {
282
284
do_test ( 3 ) . await
283
285
}
284
286
285
287
#[ tokio:: test]
286
- async fn test_q4 ( ) -> Result < ( ) > {
288
+ async fn test_q4 ( ) -> TestResult < ( ) > {
287
289
do_test ( 4 ) . await
288
290
}
289
291
290
292
#[ tokio:: test]
291
- async fn test_q5 ( ) -> Result < ( ) > {
293
+ async fn test_q5 ( ) -> TestResult < ( ) > {
292
294
do_test ( 5 ) . await
293
295
}
294
296
295
297
#[ tokio:: test]
296
- async fn test_q6 ( ) -> Result < ( ) > {
298
+ async fn test_q6 ( ) -> TestResult < ( ) > {
297
299
do_test ( 6 ) . await
298
300
}
299
301
300
302
#[ tokio:: test]
301
- async fn test_q7 ( ) -> Result < ( ) > {
303
+ async fn test_q7 ( ) -> TestResult < ( ) > {
302
304
do_test ( 7 ) . await
303
305
}
304
306
305
307
#[ tokio:: test]
306
- async fn test_q8 ( ) -> Result < ( ) > {
308
+ async fn test_q8 ( ) -> TestResult < ( ) > {
307
309
do_test ( 8 ) . await
308
310
}
309
311
310
312
#[ tokio:: test]
311
- async fn test_q9 ( ) -> Result < ( ) > {
313
+ async fn test_q9 ( ) -> TestResult < ( ) > {
312
314
do_test ( 9 ) . await
313
315
}
314
316
315
317
#[ tokio:: test]
316
- async fn test_q10 ( ) -> Result < ( ) > {
318
+ async fn test_q10 ( ) -> TestResult < ( ) > {
317
319
do_test ( 10 ) . await
318
320
}
319
321
320
322
#[ tokio:: test]
321
- async fn test_q11 ( ) -> Result < ( ) > {
323
+ async fn test_q11 ( ) -> TestResult < ( ) > {
322
324
do_test ( 11 ) . await
323
325
}
324
326
325
327
#[ tokio:: test]
326
- async fn test_q12 ( ) -> Result < ( ) > {
328
+ async fn test_q12 ( ) -> TestResult < ( ) > {
327
329
do_test ( 12 ) . await
328
330
}
329
331
330
332
#[ tokio:: test]
331
- async fn test_q13 ( ) -> Result < ( ) > {
333
+ async fn test_q13 ( ) -> TestResult < ( ) > {
332
334
do_test ( 13 ) . await
333
335
}
334
336
335
337
#[ tokio:: test]
336
- async fn test_q14 ( ) -> Result < ( ) > {
338
+ async fn test_q14 ( ) -> TestResult < ( ) > {
337
339
do_test ( 14 ) . await
338
340
}
339
341
340
342
#[ ignore]
341
343
#[ tokio:: test]
342
- async fn test_q15 ( ) -> Result < ( ) > {
344
+ async fn test_q15 ( ) -> TestResult < ( ) > {
343
345
do_test ( 15 ) . await
344
346
}
345
347
346
348
#[ tokio:: test]
347
- async fn test_q16 ( ) -> Result < ( ) > {
349
+ async fn test_q16 ( ) -> TestResult < ( ) > {
348
350
do_test ( 16 ) . await
349
351
}
350
352
351
353
#[ tokio:: test]
352
- async fn test_q17 ( ) -> Result < ( ) > {
354
+ async fn test_q17 ( ) -> TestResult < ( ) > {
353
355
do_test ( 17 ) . await
354
356
}
355
357
356
358
#[ tokio:: test]
357
- async fn test_q18 ( ) -> Result < ( ) > {
359
+ async fn test_q18 ( ) -> TestResult < ( ) > {
358
360
do_test ( 18 ) . await
359
361
}
360
362
361
363
#[ tokio:: test]
362
- async fn test_q19 ( ) -> Result < ( ) > {
364
+ async fn test_q19 ( ) -> TestResult < ( ) > {
363
365
do_test ( 19 ) . await
364
366
}
365
367
366
368
#[ tokio:: test]
367
- async fn test_q20 ( ) -> Result < ( ) > {
369
+ async fn test_q20 ( ) -> TestResult < ( ) > {
368
370
do_test ( 20 ) . await
369
371
}
370
372
371
373
#[ tokio:: test]
372
- async fn test_q21 ( ) -> Result < ( ) > {
374
+ async fn test_q21 ( ) -> TestResult < ( ) > {
373
375
do_test ( 21 ) . await
374
376
}
375
377
376
378
#[ tokio:: test]
377
- async fn test_q22 ( ) -> Result < ( ) > {
379
+ async fn test_q22 ( ) -> TestResult < ( ) > {
378
380
do_test ( 22 ) . await
379
381
}
380
382
381
- async fn do_test ( n : u8 ) -> Result < ( ) > {
382
- let data_path = "/mnt/bigdata/tpch/sf10-parquet" ;
383
- if !Path :: new ( & data_path) . exists ( ) {
384
- return Ok ( ( ) ) ;
385
- }
383
+ async fn do_test ( n : u8 ) -> TestResult < ( ) > {
384
+ let data_path = env:: var ( "TPCH_DATA_PATH" ) ?;
386
385
let file = format ! ( "testdata/queries/q{n}.sql" ) ;
387
386
let sql = fs:: read_to_string ( & file) ?;
388
387
let config = SessionConfig :: new ( ) . with_target_partitions ( 4 ) ;
0 commit comments