Skip to content

Commit 096aec9

Browse files
committed
refactor: fixing formatting errors
1 parent 60a161e commit 096aec9

File tree

3 files changed

+20
-41
lines changed

3 files changed

+20
-41
lines changed

src/import/csv.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -548,13 +548,9 @@ where
548548
}
549549

550550
// Establish parallel connections
551-
let pool = ParallelTransportPool::connect(
552-
&options.host,
553-
options.port,
554-
options.use_tls,
555-
paths.len(),
556-
)
557-
.await?;
551+
let pool =
552+
ParallelTransportPool::connect(&options.host, options.port, options.use_tls, paths.len())
553+
.await?;
558554

559555
// Build multi-file IMPORT SQL
560556
let entries: Vec<ImportFileEntry> = pool
@@ -1507,9 +1503,11 @@ mod tests {
15071503
.skip_rows(1)
15081504
.compression(Compression::Gzip);
15091505

1510-
let entries = vec![
1511-
ImportFileEntry::new("10.0.0.5:8563".to_string(), "001.csv".to_string(), None),
1512-
];
1506+
let entries = vec![ImportFileEntry::new(
1507+
"10.0.0.5:8563".to_string(),
1508+
"001.csv".to_string(),
1509+
None,
1510+
)];
15131511

15141512
let query = build_multi_file_query("data", &options, entries);
15151513
let sql = query.build();

src/import/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,13 @@ pub use arrow::{
4949
};
5050

5151
pub use csv::{
52-
import_from_callback, import_from_file, import_from_files, import_from_iter, import_from_stream,
53-
CsvImportOptions, DataPipeSender,
52+
import_from_callback, import_from_file, import_from_files, import_from_iter,
53+
import_from_stream, CsvImportOptions, DataPipeSender,
5454
};
5555

5656
pub use parquet::{
57-
import_from_parquet, import_from_parquet_files, import_from_parquet_stream, ParquetImportOptions,
57+
import_from_parquet, import_from_parquet_files, import_from_parquet_stream,
58+
ParquetImportOptions,
5859
};
5960

6061
pub use parallel::{ImportFileEntry, ParallelTransportPool};

src/import/parallel.rs

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ impl ParallelTransportPool {
104104
HttpTransportClient::connect(&host, port, use_tls)
105105
.await
106106
.map_err(|e| {
107-
ImportError::HttpTransportError(format!(
108-
"Failed to connect to Exasol: {e}"
109-
))
107+
ImportError::HttpTransportError(format!("Failed to connect to Exasol: {e}"))
110108
})
111109
});
112110
connect_handles.push(handle);
@@ -126,10 +124,7 @@ impl ParallelTransportPool {
126124
))
127125
})?
128126
.map_err(|e| {
129-
ImportError::ParallelImportError(format!(
130-
"Connection {} failed: {e}",
131-
idx
132-
))
127+
ImportError::ParallelImportError(format!("Connection {} failed: {e}", idx))
133128
})?;
134129

135130
// Generate file entry with unique file name
@@ -228,15 +223,9 @@ pub async fn stream_files_parallel(
228223

229224
// Stream data in chunks
230225
for chunk in data.chunks(CHUNK_SIZE) {
231-
client
232-
.write_chunked_body(chunk)
233-
.await
234-
.map_err(|e| {
235-
ImportError::ParallelImportError(format!(
236-
"File {} streaming failed: {e}",
237-
idx
238-
))
239-
})?;
226+
client.write_chunked_body(chunk).await.map_err(|e| {
227+
ImportError::ParallelImportError(format!("File {} streaming failed: {e}", idx))
228+
})?;
240229
}
241230

242231
// Send final chunk
@@ -260,9 +249,7 @@ pub async fn stream_files_parallel(
260249
.map_err(|e| {
261250
ImportError::ParallelImportError(format!("Stream task {} panicked: {e}", idx))
262251
})?
263-
.map_err(|e| {
264-
ImportError::ParallelImportError(format!("Stream {} failed: {e}", idx))
265-
})?;
252+
.map_err(|e| ImportError::ParallelImportError(format!("Stream {} failed: {e}", idx)))?;
266253
}
267254

268255
Ok(())
@@ -378,10 +365,7 @@ pub async fn convert_parquet_files_to_csv(
378365
let csv_data = handle
379366
.await
380367
.map_err(|e| {
381-
ImportError::ParallelImportError(format!(
382-
"Conversion task {} panicked: {e}",
383-
idx
384-
))
368+
ImportError::ParallelImportError(format!("Conversion task {} panicked: {e}", idx))
385369
})?
386370
.map_err(|e| {
387371
ImportError::ParallelImportError(format!("Conversion {} failed: {e}", idx))
@@ -411,11 +395,7 @@ mod tests {
411395

412396
#[test]
413397
fn test_import_file_entry_no_tls() {
414-
let entry = ImportFileEntry::new(
415-
"10.0.0.5:8563".to_string(),
416-
"002.csv".to_string(),
417-
None,
418-
);
398+
let entry = ImportFileEntry::new("10.0.0.5:8563".to_string(), "002.csv".to_string(), None);
419399

420400
assert_eq!(entry.address, "10.0.0.5:8563");
421401
assert_eq!(entry.file_name, "002.csv");

0 commit comments

Comments
 (0)