1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//! # fv-streams-sql — the SQL front door
//!
//! A streaming SQL statement parses to a **small typed logical plan** ([`plan::Plan`]) and lowers to
//! the *same* [`Topology`] of [`StageDef`](fv_streams_types::StageDef)s the TOML frontend produces (whose `steps` are the engine's
//! own JSON vocabulary). One runtime, two front doors: SQL inherits checkpointing, the exchange,
//! exactness and `--join` because it emits the identical steps a hand-written pipeline would.
//!
//! Deliberately **not** DataFusion's `LogicalPlan`/physical layer (design §10): our own IR models
//! streaming (DataFusion's does not), so there is no fork risk, the errors are streaming-aware and
//! ours, and the IR is the seam a future optimiser plugs into. Scalar expressions lower to the value
//! dialect strings the `expression` steps already carry, compiled through `fv-value-datafusion` at
//! build time exactly as the TOML path does.
//!
//! ```
//! let topo = fv_streams_sql::compile(
//! "INSERT INTO out SELECT auction, price * 0.908 AS eur FROM bids WHERE type = 'bid'",
//! ).unwrap();
//! assert_eq!(topo.stages.len(), 1);
//! ```
use Topology;
pub use Plan;
/// Compile one streaming SQL statement into a [`Topology`]. Datasets (the `FROM`/`INSERT INTO`
/// targets) are referenced by name; their bindings (topic, connector, schema) stay in the pipeline
/// config, exactly as the TOML frontend resolves them. Fails LOUDLY with a streaming-aware message
/// on anything outside the supported subset.
/// The optimiser seam: passes over the typed IR (filter pushdown, projection pruning, …) go here —
/// streaming-aware because the IR is. Empty today; the boundary exists so a mature optimiser is
/// additive, on our own IR, never a rewrite (design §10).
/// Lower a plan to `StageDef`s without wrapping in a `Topology` — for tests that assert the steps.
pub