Expand description
INTERVAL arithmetic rewriter for BIGINT timestamp columns Interval arithmetic rewriter for BIGINT timestamp columns.
LaminarDB uses BIGINT millisecond timestamps for event time. DataFusion
cannot natively evaluate Int64 ± INTERVAL, so this module rewrites
INTERVAL expressions in arithmetic operations to equivalent millisecond
integer literals before the SQL reaches DataFusion.
§Example
-- Before rewrite:
SELECT * FROM trades t
INNER JOIN orders o ON t.symbol = o.symbol
AND o.ts BETWEEN t.ts - INTERVAL '10' SECOND AND t.ts + INTERVAL '10' SECOND
-- After rewrite:
SELECT * FROM trades t
INNER JOIN orders o ON t.symbol = o.symbol
AND o.ts BETWEEN t.ts - 10000 AND t.ts + 10000Functions§
- rewrite_
expr_ mut - Rewrite INTERVAL arithmetic in an expression tree, in place.
- rewrite_
interval_ arithmetic - Rewrite all INTERVAL arithmetic in a SQL
Statement.