Skip to main content

radixdb_executor/expression/
mod.rs

1// Copyright 2026 RadixDB Contributors
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Compiled Expression VM - Complete Replacement for AST Evaluator
16//
17// This module provides a high-performance expression evaluation system that
18// completely replaces the recursive AST evaluator with a compiled, stack-based VM.
19//
20// Design Goals:
21// 1. ZERO RECURSION - All expressions compile to linear instruction sequences
22// 2. MINIMAL ALLOCATION - Reuse stack, pre-allocate everything possible
23// 3. FAST DISPATCH - Direct enum match, no string comparisons
24// 4. COMPLETE COVERAGE - Handle ALL expression types including subqueries
25//
26// Architecture:
27//
28//   ┌─────────────┐     ┌──────────────┐     ┌─────────────┐
29//   │ Expression  │ ──► │ ExprCompiler │ ──► │   Program   │
30//   │    (AST)    │     │              │     │  (bytecode) │
31//   └─────────────┘     └──────────────┘     └─────────────┘
32//                                                   │
33//                                                   ▼
34//   ┌─────────────┐     ┌──────────────┐     ┌─────────────┐
35//   │   Result    │ ◄── │    ExprVM    │ ◄── │  Row Data   │
36//   │   (Value)   │     │              │     │             │
37//   └─────────────┘     └──────────────┘     └─────────────┘
38
39mod compiler;
40mod evaluator_bridge;
41mod execution_context;
42mod ops;
43mod program;
44mod vm;
45
46pub use compiler::{
47    expression_to_string, is_non_foldable_function, string_to_datatype, CompileContext,
48    CompileError, ExprCompiler,
49};
50pub use evaluator_bridge::{
51    clear_program_cache, compile_expression, compile_expression_with_context,
52    compute_expression_hash, try_eval_constant_expr, CompiledEvaluator, ExpressionEval, JoinFilter,
53    MultiExpressionEval, RowFilter, SharedProgram,
54};
55pub use execution_context::ExecuteContext;
56pub use ops::Op;
57pub use program::{Constant, Program};
58pub use vm::ExprVM;
59
60#[cfg(test)]
61mod tests;