robin_sparkless/lib.rs
1//! Robin Sparkless - A Rust DataFrame library with PySpark-like API
2//!
3//! This library provides a PySpark-compatible API built on top of Polars,
4//! offering high-performance data processing in pure Rust.
5//!
6//! # Getting started and embedding
7//!
8//! For application code and embedding, use the [prelude]: `use robin_sparkless::prelude::*`.
9//! For a minimal FFI surface, use [prelude::embed].
10//!
11//! # Panics and errors
12//!
13//! Some functions panic when used with invalid or empty inputs (e.g. calling
14//! `when(cond).otherwise(val)` without `.then()`, or passing no columns to
15//! `format_string`, `elt`, `concat`, `coalesce`, or `named_struct` in Rust).
16//! In Rust, `create_map` and `array` return `Result` for empty input instead of
17//! panicking. From Python, empty columns for `coalesce`, `format_string`,
18//! `printf`, and `named_struct` raise `ValueError`. See the documentation for
19//! each function for details.
20//!
21//! # API stability
22//!
23//! While the crate is in the 0.x series, we follow [semver](https://semver.org/) but may introduce
24//! breaking changes in minor releases (e.g. 0.1 → 0.2) until 1.0. For behavioral caveats and
25//! intentional differences from PySpark, see the [repository documentation](https://github.com/eddiethedean/robin-sparkless/blob/main/docs/PYSPARK_DIFFERENCES.md).
26
27#![allow(clippy::collapsible_if)]
28#![allow(clippy::let_and_return)]
29
30pub mod column;
31pub mod config;
32pub mod dataframe;
33pub(crate) mod date_utils;
34pub mod error;
35pub mod expression;
36pub mod functions;
37pub mod plan;
38pub mod prelude;
39pub mod schema;
40pub mod session;
41pub mod traits;
42pub mod type_coercion;
43pub(crate) mod udf_registry;
44pub(crate) mod udfs;
45
46/// Re-export the underlying expression and literal types so downstream
47/// bindings can depend on `robin_sparkless::Expr` / `LiteralValue`
48/// instead of importing Polars directly.
49pub type Expr = polars::prelude::Expr;
50pub type LiteralValue = polars::prelude::LiteralValue;
51
52#[cfg(feature = "sql")]
53pub mod sql;
54
55#[cfg(feature = "delta")]
56pub mod delta;
57
58pub use column::Column;
59pub use config::SparklessConfig;
60pub use dataframe::{
61 CubeRollupData, DataFrame, GroupedData, JoinType, PivotedGroupedData, SaveMode, WriteFormat,
62 WriteMode,
63};
64pub use error::EngineError;
65pub use functions::{SortOrder, *};
66pub use schema::{DataType, StructField, StructType, schema_from_json};
67pub use session::{DataFrameReader, SparkSession, SparkSessionBuilder};
68pub use traits::{FromRobinDf, IntoRobinDf};