cqlite_core/export/mod.rs
1//! Embeddable export writers (Epic #682)
2//!
3//! This module hosts writers that convert query results into external file
4//! formats so that non-CLI consumers (projection services, the Python/Node
5//! bindings, library embedders) can produce them without shelling out to the
6//! CLI.
7//!
8//! # Feature flags
9//!
10//! | Submodule | Feature | In defaults? |
11//! |-----------------|----------------------------|--------------|
12//! | `arrow_convert` | `arrow` | No |
13//! | `parquet` | `parquet` | No |
14//! | `delta_schema` | `delta-scan` + `arrow` | No |
15//! | `delta_parquet` | `delta-scan` + `parquet` | No |
16//!
17//! The `arrow` feature pulls in the `arrow` crate as an optional dependency
18//! and exposes `build_arrow_schema` / `rows_to_record_batch` for use by any
19//! consumer that wants Arrow RecordBatches without Parquet.
20//!
21//! The `parquet` feature depends on `arrow` and additionally pulls in the
22//! `parquet` crate; it is off by default so the default build's dependency
23//! surface is unchanged.
24//!
25//! The `delta_parquet` module (DS8, Issue #704) is compiled only when both
26//! `delta-scan` and `parquet` are enabled. It depends on `delta_schema`
27//! (DS7, Issue #703) for schema derivation and reuses the epic #682 Arrow
28//! writer machinery — no forked writer.
29//!
30//! # External-committer boundary
31//!
32//! Per the decisions in `docs/architecture/cassandra-sidecar-parquet-projections.md`,
33//! CQLite produces Parquet **files** only. Committing those files to lakehouse
34//! table formats (Iceberg, Delta) — manifest/metadata transactions, snapshot
35//! management — is the job of an external committer and is deliberately out of
36//! scope for this crate.
37
38#[cfg(feature = "arrow")]
39pub mod arrow_convert;
40
41#[cfg(feature = "parquet")]
42pub mod parquet;
43
44// Re-export the public arrow_convert API at the `export` module level.
45#[cfg(feature = "arrow")]
46pub use arrow_convert::{build_arrow_schema, rows_to_record_batch, ArrowConvertError};
47
48// Delta-scan Arrow schema derivation (Epic #696, Issue #703 / DS7).
49// Requires both `delta-scan` (for the CDC envelope model) and `arrow` (for
50// ArrowDataType / Field / Schema). The `parquet` feature is NOT required —
51// schema derivation is independent of writing Parquet files.
52#[cfg(all(feature = "delta-scan", feature = "arrow"))]
53pub mod delta_schema;
54
55#[cfg(all(feature = "delta-scan", feature = "arrow"))]
56pub use delta_schema::{derive_delta_schema, DeltaSchemaError, DeltaSchemaOpts};
57
58// Delta-scan Parquet writer (Epic #696, Issue #704 / DS8).
59// Requires both `delta-scan` AND `parquet` (which implies `arrow`).
60// Absent from default builds — neither delta-scan nor parquet is in the
61// default feature set.
62#[cfg(all(feature = "delta-scan", feature = "parquet"))]
63pub mod delta_parquet;
64
65#[cfg(all(feature = "delta-scan", feature = "parquet"))]
66pub use delta_parquet::{
67 write_delta_records_to_bytes, DeltaParquetCompression, DeltaParquetError, DeltaParquetOptions,
68 DeltaParquetWriter,
69};