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(crate) mod sink_format;
10pub mod strategy;
11
12use std::path::{Path, PathBuf};
13
14use crate::FloeResult;
15
16pub fn write_error_report(
17 output_path: &Path,
18 errors_per_row: &[Option<String>],
19) -> FloeResult<PathBuf> {
20 if let Some(parent) = output_path.parent() {
21 std::fs::create_dir_all(parent)?;
22 }
23 let mut items = Vec::new();
24 for (idx, err) in errors_per_row.iter().enumerate() {
25 if let Some(err) = err {
26 items.push(format!("{{\"row_index\":{},\"errors\":{}}}", idx, err));
27 }
28 }
29 let content = format!("[{}]", items.join(","));
30 std::fs::write(output_path, content)?;
31 Ok(output_path.to_path_buf())
32}
33
34pub fn write_rejected_raw(source_path: &Path, output_path: &Path) -> FloeResult<PathBuf> {
35 if let Some(parent) = output_path.parent() {
36 std::fs::create_dir_all(parent)?;
37 }
38 std::fs::copy(source_path, output_path)?;
39 Ok(output_path.to_path_buf())
40}