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
//! SQL query engine powered by Apache `DataFusion`.
//!
//! This module integrates `DataFusion` as the SQL execution engine for Chronix,
//! enabling full SQL support including:
//!
//! - Standard SQL: `SELECT`, `WHERE`, `GROUP BY`, `ORDER BY`, `LIMIT`
//! - Aggregate functions: `SUM`, `AVG`, `MIN`, `MAX`, `COUNT`
//! - Time-series functions: `time_bucket()`, `first()`, `last()`, `rate()`, `irate()`
//! - Window functions: `ROW_NUMBER`, `RANK`, `LAG`, `LEAD`, rolling aggregates
//!
//! `ASOF JOIN` is **not** SQL syntax — DataFusion's parser has none, and this
//! crate adds none. It is a Rust API, [`execute_asof_join`], over two physical
//! plans; see [`asof_join`] for the shape of a call.
//!
//! Chronix measurements are registered as `DataFusion` tables via a custom
//! catalog provider that dynamically reflects the database schema.
//!
//! # Stability
//!
//! Everything exported here takes or returns a `DataFusion` type, so this
//! module's signatures move when `DataFusion` does — a major bump there is a
//! breaking change here, whatever this crate's own version says. Callers who
//! want that coupling use these; callers who do not use
//! [`Chronix::sql`](crate::Chronix::sql), which returns Arrow `RecordBatch`es
//! and nothing else.
/// The name of the time column.
///
/// Re-exported from [`chronix_core::TIME_COLUMN`] so SQL cannot drift from
/// storage: they were different names — `_time` here, `timestamp` there,
/// `time` in the schema registry — and the endpoint that reported a schema
/// had to pick one, so "read the schema, then write a query" failed.
pub use TIME_COLUMN;
pub use ;
pub use to_archive_batch;
pub use ;
pub use register_udfs;
pub use measurement_schema_to_archive_arrow;
pub use measurement_schema_to_arrow;
pub use ;