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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! Module: query::plan::model_builder
//! Responsibility: pure logical plan-model constructors/builders.
//! Does not own: access-plan coupling or semantic interpretation.
//! Boundary: model-only helpers that remain independent of access planning.
use crate::db::query::plan::{DeleteSpec, FieldSlot, GroupedExecutionConfig, LoadSpec};
impl LoadSpec {
/// Create an empty load spec.
#[must_use]
pub const fn new() -> Self {
Self {
limit: None,
offset: 0,
}
}
}
impl DeleteSpec {
/// Create an empty delete spec.
#[must_use]
pub const fn new() -> Self {
Self {
limit: None,
offset: 0,
}
}
}
impl FieldSlot {
/// Build one field slot directly for tests that need invalid slot shapes.
#[cfg(test)]
#[must_use]
pub(crate) fn from_parts_for_test(index: usize, field: impl Into<String>) -> Self {
Self {
index,
field: field.into(),
kind: None,
}
}
}
impl GroupedExecutionConfig {
/// Build one grouped execution config with explicit hard limits.
#[must_use]
pub(crate) const fn with_hard_limits(max_groups: u64, max_group_bytes: u64) -> Self {
Self {
max_groups,
max_group_bytes,
}
}
/// Build one unbounded grouped execution config.
#[must_use]
pub(crate) const fn unbounded() -> Self {
Self::with_hard_limits(u64::MAX, u64::MAX)
}
/// Return grouped hard limit for maximum groups.
#[must_use]
pub(crate) const fn max_groups(&self) -> u64 {
self.max_groups
}
/// Return grouped hard limit for estimated grouped bytes.
#[must_use]
pub(crate) const fn max_group_bytes(&self) -> u64 {
self.max_group_bytes
}
}
impl Default for GroupedExecutionConfig {
fn default() -> Self {
Self::unbounded()
}
}