speed up cli load.
@@ -206,9 +206,8 @@ impl LoadCommand {
if batch.is_empty() {
break;
}
- let values = batch
+ let values: Vec<String> = batch
.into_iter()
- .par_bridge()
.map(|s| {
s.iter()
.map(|i| {
@@ -222,8 +221,8 @@ impl LoadCommand {
})
.map(|e| format!("({})", e.trim()))
.filter(|e| !e.trim().is_empty())
- .reduce_with(|a, b| format!("{}, {}", a, b));
- if let Some(values) = values {
+ .collect();
+ let values = values.join(",");
let query = format!("INSERT INTO {} VALUES {}", table_format, values);
if let Err(e) = execute_query_json(&cli, &url, query.clone()).await {
writer.write_err(format!(
@@ -232,8 +231,6 @@ impl LoadCommand {
))
}
}
- }
-
let elapsed = start.elapsed();
let time = elapsed.as_millis() as f64 / 1000f64;
writer.write_ok(format!(
