Skip to content

Commit b81878e

Browse files
author
Rickard Lundin
committed
fmt
1 parent 38e4f34 commit b81878e

3 files changed

Lines changed: 22 additions & 14 deletions

File tree

src/chunked/arrow_converter.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,9 @@ pub(crate) struct Slice2Arrow<'a> {
7676
pub(crate) fn_line_break_len: FnLineBreakLen,
7777
pub(crate) masterbuilders: MasterBuilders,
7878
pub(crate) consistent_counter: ConsistentCounter,
79-
pub(crate) threaded_write: (Sender<RecordBatch>,JoinHandle<Result<Stats>>)
79+
pub(crate) threaded_write: (Sender<RecordBatch>, JoinHandle<Result<Stats>>),
8080
}
8181

82-
8382
pub(crate) struct MasterBuilders {
8483
builders: Vec<Vec<Box<dyn Sync + Send + ColumnBuilder>>>,
8584
outfile: PathBuf,

src/chunked/threaded_file_output.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ use super::{
4848
Stats,
4949
};
5050
use crate::chunked;
51+
use crate::cli::Targets;
5152
use crate::datatype::DataType;
5253
use crate::schema;
5354
use arrow::datatypes::{Field, Schema, SchemaRef};
@@ -66,22 +67,27 @@ use std::thread::JoinHandle;
6667
use std::time::{Duration, Instant};
6768
use thread::spawn;
6869
use Compression::SNAPPY;
69-
use crate::cli::Targets;
7070

7171
pub(crate) struct parquet_file_out {
7272
pub(crate) sender: Option<Sender<RecordBatch>>,
7373
}
74-
pub(crate) fn output_factory (target: Targets,schema: SchemaRef,_outfile:PathBuf) -> (Sender<RecordBatch>, JoinHandle<Result<Stats>>) {
74+
pub(crate) fn output_factory(
75+
target: Targets,
76+
schema: SchemaRef,
77+
_outfile: PathBuf,
78+
) -> (Sender<RecordBatch>, JoinHandle<Result<Stats>>) {
7579
match target {
7680
Targets::Parquet => {
77-
let mut pfo: Box<dyn arrow_file_output> = Box::new(parquet_file_out { sender: None });
78-
pfo.setup(schema, _outfile)
81+
let mut pfo: Box<dyn arrow_file_output> = Box::new(parquet_file_out { sender: None });
82+
pfo.setup(schema, _outfile)
7983
}
8084
Targets::IPC => {
8185
let mut pfo: Box<dyn arrow_file_output> = Box::new(ipc_file_out { sender: None });
8286
pfo.setup(schema, _outfile)
8387
}
84-
Targets::None => {todo!()}
88+
Targets::None => {
89+
todo!()
90+
}
8591
}
8692
}
8793
impl arrow_file_output for parquet_file_out {

src/cli.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,23 @@ use log::info;
3333
#[cfg(feature = "rayon")]
3434
use parquet::arrow::ArrowWriter;
3535

36+
use arrow::datatypes::SchemaRef;
37+
use atomic_counter::ConsistentCounter;
3638
#[cfg(feature = "rayon")]
3739
use std::fs;
3840
#[cfg(feature = "rayon")]
3941
use std::fs::File;
4042
use std::path::PathBuf;
41-
use arrow::datatypes::SchemaRef;
42-
use atomic_counter::ConsistentCounter;
4343

4444
#[cfg(feature = "rayon")]
4545
use crate::chunked::arrow_converter::{MasterBuilders, Slice2Arrow};
4646
#[cfg(feature = "rayon")]
4747
use crate::chunked::residual_slicer::ResidualSlicer;
4848
#[cfg(feature = "rayon")]
4949
use crate::chunked::self_converter::SampleSliceAggregator;
50+
use crate::chunked::threaded_file_output::output_factory;
5051
#[cfg(feature = "rayon")]
5152
use crate::chunked::{find_last_nl, line_break_len_cr, Converter as ChunkedConverter, Slicer};
52-
use crate::chunked::threaded_file_output::output_factory;
5353
use crate::converter::Converter;
5454
use crate::error::Result;
5555
use crate::mocker::Mocker;
@@ -107,7 +107,6 @@ pub struct Cli {
107107
n_threads: usize,
108108
}
109109

110-
111110
#[derive(Subcommand)]
112111
enum Commands {
113112
/// Convert a fixed-length file (.flf) to parquet.
@@ -294,14 +293,18 @@ impl Cli {
294293
schema.to_path_buf(),
295294
n_threads as i16,
296295
);
297-
let sc=master_builders.schema_factory();
298-
296+
let sc = master_builders.schema_factory();
297+
299298
let s2a: Box<Slice2Arrow> = Box::new(Slice2Arrow {
300299
fn_line_break: find_last_nl,
301300
fn_line_break_len: line_break_len_cr,
302301
masterbuilders: master_builders,
303302
consistent_counter: ConsistentCounter::new(0),
304-
threaded_write: output_factory(self.target.clone(),sc ,out_file.clone().to_path_buf()),
303+
threaded_write: output_factory(
304+
self.target.clone(),
305+
sc,
306+
out_file.clone().to_path_buf(),
307+
),
305308
});
306309
s2a
307310
}

0 commit comments

Comments
 (0)