Read csv from stdin too
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				ci/woodpecker/push/woodpecker Pipeline was successful
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	ci/woodpecker/push/woodpecker Pipeline was successful
				
			This commit is contained in:
		
							parent
							
								
									e4e9b71674
								
							
						
					
					
						commit
						1e18c9ae9f
					
				
							
								
								
									
										46
									
								
								src/main.rs
									
									
									
									
									
								
							
							
						
						
									
										46
									
								
								src/main.rs
									
									
									
									
									
								
							|  | @ -110,31 +110,31 @@ fn main() { | ||||||
|         ) |         ) | ||||||
|         .get_matches(); |         .get_matches(); | ||||||
|     if let Some(_matches) = matches.subcommand_matches("csv") { |     if let Some(_matches) = matches.subcommand_matches("csv") { | ||||||
|         if let Some(path) = _matches.get_one::<String>("path") { |         let mut ldf = if _matches.get_flag("stdin") { | ||||||
|             let mut ldf = LazyFrame::default(); |             io::load_csv_from_stdin() | ||||||
|             if _matches.get_flag("stdin") { |         } else { | ||||||
|                 ldf = io::load_csv_from_stdin(); |             let path = _matches | ||||||
|  |                 .get_one::<String>("path") | ||||||
|  |                 .expect("Please, provide a file"); | ||||||
|  |             io::read_csv(path.to_string()) | ||||||
|  |         }; | ||||||
|  |         if let Some(query) = _matches.get_one::<String>("query") { | ||||||
|  |             ldf = sql::execute(ldf, query); | ||||||
|  |         } | ||||||
|  |         if _matches.get_flag("summary") { | ||||||
|  |             let df = ldf.collect().expect("Could not collect"); | ||||||
|  |             println!("{}", df.describe(None)); | ||||||
|  |         } else if _matches.get_flag("head") { | ||||||
|  |             let df = ldf.fetch(5).expect("Could not fetch"); | ||||||
|  |             println!("{}", df) | ||||||
|  |         } else { | ||||||
|  |             if _matches.get_flag("text") { | ||||||
|  |                 io::dump_csv_to_stdout(ldf); | ||||||
|             } else { |             } else { | ||||||
|                 ldf = io::read_csv(path.to_string()); |                 if let Some(path) = _matches.get_one::<String>("parquet") { | ||||||
|             } |                     io::write_parquet(ldf, path.to_string()); | ||||||
|             if let Some(query) = _matches.get_one::<String>("query") { |  | ||||||
|                 ldf = sql::execute(ldf, query); |  | ||||||
|             } |  | ||||||
|             if _matches.get_flag("summary") { |  | ||||||
|                 let df = ldf.collect().expect("Could not collect"); |  | ||||||
|                 println!("{}", df.describe(None)); |  | ||||||
|             } else if _matches.get_flag("head") { |  | ||||||
|                 let df = ldf.fetch(5).expect("Could not fetch"); |  | ||||||
|                 println!("{}", df) |  | ||||||
|             } else { |  | ||||||
|                 if _matches.get_flag("text") { |  | ||||||
|                     io::dump_csv_to_stdout(ldf); |  | ||||||
|                 } else { |                 } else { | ||||||
|                     if let Some(path) = _matches.get_one::<String>("parquet") { |                     io::write_ipc(ldf); | ||||||
|                         io::write_parquet(ldf, path.to_string()); |  | ||||||
|                     } else { |  | ||||||
|                         io::write_ipc(ldf); |  | ||||||
|                     } |  | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue