File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -592,10 +592,19 @@ impl CliApp {
592592 . analyze_query_raw ( sql)
593593 . await ?;
594594
595- println ! ( "==================== Query ====================" ) ;
596- println ! ( "{}" , query_str) ;
597- println ! ( "\n ==================== Metrics ====================" ) ;
598- self . print_batch ( & metrics_batch) ?;
595+ if let Some ( output_path) = & self . args . output {
596+ // Write metrics batch to file
597+ let schema = metrics_batch. schema ( ) ;
598+ let mut writer = path_to_writer ( output_path, schema) ?;
599+ writer. write ( & metrics_batch) ?;
600+ writer. close ( ) . await ?;
601+ } else {
602+ // Print to stdout
603+ println ! ( "==================== Query ====================" ) ;
604+ println ! ( "{}" , query_str) ;
605+ println ! ( "\n ==================== Metrics ====================" ) ;
606+ self . print_batch ( & metrics_batch) ?;
607+ }
599608 } else {
600609 // Normal mode: reconstruct and display ExecutionStats
601610 let stats = self
You can’t perform that action at this time.
0 commit comments