radixdb_executor/
compiled_plan.rs1use std::sync::Arc;
4
5use radixdb_core::{CompactArc, DataType, Schema, SmartString, Value};
6
7#[derive(Debug, Clone)]
9pub enum PkValueSource {
10 Parameter(usize),
11 Literal(i64),
12 NamedParameter(SmartString),
13}
14
15#[derive(Debug, Clone)]
17pub struct CompiledPkLookup {
18 pub table_name: SmartString,
19 pub schema: CompactArc<Schema>,
20 pub column_names: CompactArc<Vec<String>>,
21 pub pk_value_source: PkValueSource,
22 pub cached_epoch: u64,
23}
24
25#[derive(Debug, Clone)]
27pub struct CompiledUpdateColumn {
28 pub column_idx: usize,
29 pub column_type: DataType,
30 pub value_source: UpdateValueSource,
31}
32
33#[derive(Debug, Clone)]
35pub enum UpdateValueSource {
36 Literal(Value),
37 Parameter(usize),
38 NamedParameter(SmartString),
39}
40
41#[derive(Debug, Clone)]
43pub struct CompiledPkUpdate {
44 pub table_name: SmartString,
45 pub schema: CompactArc<Schema>,
46 pub pk_column_name: SmartString,
47 pub pk_value_source: PkValueSource,
48 pub updates: Vec<CompiledUpdateColumn>,
49 pub cached_epoch: u64,
50}
51
52#[derive(Debug, Clone)]
54pub struct CompiledPkDelete {
55 pub table_name: SmartString,
56 pub schema: CompactArc<Schema>,
57 pub pk_column_name: SmartString,
58 pub pk_value_source: PkValueSource,
59 pub cached_epoch: u64,
60}
61
62#[derive(Debug, Clone)]
64pub struct CompiledInsert {
65 pub table_name: SmartString,
66 pub column_indices: Arc<Vec<usize>>,
67 pub column_types: Arc<Vec<DataType>>,
68 pub column_vector_dims: Arc<Vec<u16>>,
69 pub column_names: Arc<Vec<SmartString>>,
70 pub all_column_types: Arc<Vec<DataType>>,
71 pub default_row_template: Arc<Vec<Value>>,
72 pub cached_epoch: u64,
73}
74
75#[derive(Debug, Clone)]
77pub struct CompiledCountDistinct {
78 pub table_name: SmartString,
79 pub column_name: SmartString,
80 pub result_column_name: String,
81 pub cached_epoch: u64,
82}
83
84#[derive(Debug, Clone)]
86pub struct CompiledCountStar {
87 pub table_name: SmartString,
88 pub result_column_name: String,
89 pub cached_epoch: u64,
90}
91
92#[derive(Debug, Clone, Default)]
94pub enum CompiledExecution {
95 #[default]
96 Unknown,
97 NotOptimizable(u64),
98 PkLookup(CompiledPkLookup),
99 PkUpdate(CompiledPkUpdate),
100 PkDelete(CompiledPkDelete),
101 Insert(CompiledInsert),
102 CountDistinct(CompiledCountDistinct),
103 CountStar(CompiledCountStar),
104}