Commit ee2b9ef 1 parent b84789a commit ee2b9ef Copy full SHA for ee2b9ef
File tree 2 files changed +7
-5
lines changed
2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -29,17 +29,16 @@ pub struct PrintOptions {
29
29
30
30
fn print_timing_info ( row_count : usize , now : Instant ) {
31
31
println ! (
32
- "{} {} in set. Query took {} seconds." ,
32
+ "{} {} in set. Query took {:.3 } seconds." ,
33
33
row_count,
34
34
if row_count == 1 { "row" } else { "rows" } ,
35
- now. elapsed( ) . as_secs ( )
35
+ now. elapsed( ) . as_secs_f64 ( )
36
36
) ;
37
37
}
38
38
39
39
impl PrintOptions {
40
40
/// print the batches to stdout using the specified format
41
- pub fn print_batches ( & self , batches : & [ RecordBatch ] ) -> Result < ( ) > {
42
- let now = Instant :: now ( ) ;
41
+ pub fn print_batches ( & self , batches : & [ RecordBatch ] , now : Instant ) -> Result < ( ) > {
43
42
if batches. is_empty ( ) {
44
43
if !self . quiet {
45
44
print_timing_info ( 0 , now) ;
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ use std::fs::File;
30
30
use std:: io:: prelude:: * ;
31
31
use std:: io:: BufReader ;
32
32
use std:: path:: Path ;
33
+ use std:: time:: Instant ;
33
34
34
35
#[ tokio:: main]
35
36
pub async fn main ( ) {
@@ -238,7 +239,9 @@ async fn exec_and_print(
238
239
sql : String ,
239
240
) -> Result < ( ) > {
240
241
let df = ctx. sql ( & sql) ?;
242
+ let now = Instant :: now ( ) ;
241
243
let results = df. collect ( ) . await ?;
242
- print_options. print_batches ( & results) ?;
244
+
245
+ print_options. print_batches ( & results, now) ?;
243
246
Ok ( ( ) )
244
247
}
You can’t perform that action at this time.
0 commit comments