floe_core/io/write/
mod.rs1pub mod accepted;
2pub mod arrow_convert;
3pub mod csv;
4pub mod delta;
5pub mod iceberg;
6pub mod metrics;
7pub mod parquet;
8pub mod parts;
9pub mod strategy;
10
11use std::path::{Path, PathBuf};
12
13use crate::FloeResult;
14
15pub fn write_error_report(
16 output_path: &Path,
17 errors_per_row: &[Option<String>],
18) -> FloeResult<PathBuf> {
19 if let Some(parent) = output_path.parent() {
20 std::fs::create_dir_all(parent)?;
21 }
22 let mut items = Vec::new();
23 for (idx, err) in errors_per_row.iter().enumerate() {
24 if let Some(err) = err {
25 items.push(format!("{{\"row_index\":{},\"errors\":{}}}", idx, err));
26 }
27 }
28 let content = format!("[{}]", items.join(","));
29 std::fs::write(output_path, content)?;
30 Ok(output_path.to_path_buf())
31}
32
33pub fn write_rejected_raw(source_path: &Path, output_path: &Path) -> FloeResult<PathBuf> {
34 if let Some(parent) = output_path.parent() {
35 std::fs::create_dir_all(parent)?;
36 }
37 std::fs::copy(source_path, output_path)?;
38 Ok(output_path.to_path_buf())
39}