pub struct EncodedSolutions { /* private fields */ }Expand description
Variable-keyed columnar solutions of interned TermIds.
Rows may live in batch and/or in TermId page files (Self::is_parked).
Random-access methods hydrate files into RAM once; join chunking streams
pages without loading the full table.
Implementations§
Source§impl EncodedSolutions
impl EncodedSolutions
Sourcepub fn from_scan(
dict: Arc<TermDict>,
scan: &ScanOp,
rows: Vec<EncodedQuad>,
) -> Result<Self, ComputeError>
pub fn from_scan( dict: Arc<TermDict>, scan: &ScanOp, rows: Vec<EncodedQuad>, ) -> Result<Self, ComputeError>
Project scan rows onto live and counted variables that the scan binds.
Slot Options stay set even when a name is dead. Repeated names
(?x :p ?x) still build equality pairs on the quad and drop rows
whose slots disagree. Live names and counted names (COUNT(?v) /
plain COUNT(*) multiplicity) are included in the TermId schema;
other dead names are omitted.
Merge-default scans (ScanOp::merge_default_graph) already unique S/P/O on
storage and rewrite G to EncodedTerm::DefaultGraph. This projection
still ignores G when scan.graph is unset — users never see that slot.
Sourcepub fn from_domain_scan_hits(
dict: Arc<TermDict>,
scan: &ScanOp,
kind: DomainScanKind,
hits: &[DomainScanHit],
) -> Result<Self, ComputeError>
pub fn from_domain_scan_hits( dict: Arc<TermDict>, scan: &ScanOp, kind: DomainScanKind, hits: &[DomainScanHit], ) -> Result<Self, ComputeError>
Build from (constraint, head) domain-scan hits.
Columns follow S/P/O/G order: the constraint slot sorts before the
head slot except on ObjectPreds (head ?p, constraint ?o), and a
live grounded ?g projects last as the bound graph constant. Const
constraints produce no constraint column; grounded-kept constraints
repeat the constant on every row.
Sourcepub fn from_domain_count_hits(
dict: Arc<TermDict>,
scan: &ScanOp,
kind: DomainScanKind,
hits: &[DomainScanCountHit],
) -> Result<Self, ComputeError>
pub fn from_domain_count_hits( dict: Arc<TermDict>, scan: &ScanOp, kind: DomainScanKind, hits: &[DomainScanCountHit], ) -> Result<Self, ComputeError>
Build from domain count hits by run-length expansion: count copies
of each pair’s row, in key order. Page columns are
[domain_rpc_count_page_columns] — counted dead slots get a bound
placeholder so Group COUNT(?v) matches multiplicity without
broadcasting subject terms on the wire.
Sourcepub fn from_head_terms(
dict: Arc<TermDict>,
scan: &ScanOp,
kind: HeadScanKind,
terms: &[EncodedTerm],
) -> Result<Self, ComputeError>
pub fn from_head_terms( dict: Arc<TermDict>, scan: &ScanOp, kind: HeadScanKind, terms: &[EncodedTerm], ) -> Result<Self, ComputeError>
Build from bare axis-head terms. Live columns: the head, plus — on the
TSG classes scan — the implicit rdf:type predicate when a
grounded-kept ?p is projected, and a grounded ?g as the bound
graph constant. The bare gates keep every other slot dead.
Sourcepub fn from_bound_rows(
dict: Arc<TermDict>,
variables: Vec<Variable>,
rows: Vec<Vec<EncodedTerm>>,
) -> Result<Self, ComputeError>
pub fn from_bound_rows( dict: Arc<TermDict>, variables: Vec<Variable>, rows: Vec<Vec<EncodedTerm>>, ) -> Result<Self, ComputeError>
Build from fully bound rows.
Sourcepub fn empty(dict: Arc<TermDict>, variables: Vec<Variable>) -> Self
pub fn empty(dict: Arc<TermDict>, variables: Vec<Variable>) -> Self
Empty solution set over variables.
Sourcepub fn optional_rows(
&self,
) -> Result<Vec<Vec<Option<EncodedTerm>>>, ComputeError>
pub fn optional_rows( &self, ) -> Result<Vec<Vec<Option<EncodedTerm>>>, ComputeError>
Rows with unbound cells as None (for OPTIONAL / FILTER).
Sourcepub fn fill_optional_row(
&self,
row: usize,
out: &mut [Option<EncodedTerm>],
) -> Result<(), ComputeError>
pub fn fill_optional_row( &self, row: usize, out: &mut [Option<EncodedTerm>], ) -> Result<(), ComputeError>
Fill out with encoded terms for row (one dict lock). out.len() is width.
Sourcepub fn from_optional_rows(
dict: Arc<TermDict>,
variables: Vec<Variable>,
rows: Vec<Vec<Option<EncodedTerm>>>,
) -> Result<Self, ComputeError>
pub fn from_optional_rows( dict: Arc<TermDict>, variables: Vec<Variable>, rows: Vec<Vec<Option<EncodedTerm>>>, ) -> Result<Self, ComputeError>
Build from optional row cells (None = unbound).
Sourcepub fn get(
&self,
row: usize,
variable: &Variable,
) -> Result<Option<EncodedTerm>, ComputeError>
pub fn get( &self, row: usize, variable: &Variable, ) -> Result<Option<EncodedTerm>, ComputeError>
Value of variable in row, if this set binds it.
Ok(None) is unbound or a name this table does not carry. Err is a
hydrate failure on a parked table — not an unbound cell.
Sourcepub fn is_bound(
&self,
row: usize,
variable: &Variable,
) -> Result<bool, ComputeError>
pub fn is_bound( &self, row: usize, variable: &Variable, ) -> Result<bool, ComputeError>
Whether variable is bound in row.
Sourcepub fn column(
&self,
variable: &Variable,
) -> Result<Option<&TermColumn>, ComputeError>
pub fn column( &self, variable: &Variable, ) -> Result<Option<&TermColumn>, ComputeError>
Column for variable, if this set binds it.
Missing schema names return Ok(None) without hydrating. Parked-file
I/O errors return Err.
Sourcepub fn left_join(
&self,
right: &Self,
hash_keys: &[Variable],
early_filter: Option<&Expression>,
env: &ExprEvalEnv,
) -> Result<Self, ComputeError>
pub fn left_join( &self, right: &Self, hash_keys: &[Variable], early_filter: Option<&Expression>, env: &ExprEvalEnv, ) -> Result<Self, ComputeError>
Left outer join for SPARQL OPTIONAL (Phase 9c).
early_filter is folded into the Diff-once probe. Immediate gather fails
closed on NeedsResolve (see left_hash_join_columnar); callers that
need ground Diff-once for NeedsResolve must use Self::left_join_indices.
Sourcepub fn left_join_indices(
&self,
right: &Self,
hash_keys: &[Variable],
early_filter: Option<&Expression>,
env: &ExprEvalEnv,
) -> Result<LeftJoinIndices, ComputeError>
pub fn left_join_indices( &self, right: &Self, hash_keys: &[Variable], early_filter: Option<&Expression>, env: &ExprEvalEnv, ) -> Result<LeftJoinIndices, ComputeError>
Diff-once index lists for OPTIONAL (before gather), with early probe marks.
Sourcepub fn gather_left_join(
&self,
right: &Self,
indices: &LeftJoinIndices,
) -> Result<Self, ComputeError>
pub fn gather_left_join( &self, right: &Self, indices: &LeftJoinIndices, ) -> Result<Self, ComputeError>
Gather LeftJoin output from (possibly residual-filtered) index lists.
Sourcepub fn hash_join(
&self,
right: &Self,
hash_keys: &[Variable],
) -> Result<Self, ComputeError>
pub fn hash_join( &self, right: &Self, hash_keys: &[Variable], ) -> Result<Self, ComputeError>
Inner hash join with right on always-bound hash_keys (columnar kernel).
An empty hash_keys list is a cartesian product (then soft reconcile for
shared maybe-unbound columns). The smaller side is the build side.
Sourcepub fn hash_join_capped(
&self,
right: &Self,
hash_keys: &[Variable],
max_out: usize,
cursor: JoinCursor,
build: &mut Option<JoinBuild>,
) -> Result<(Self, Option<JoinCursor>), ComputeError>
pub fn hash_join_capped( &self, right: &Self, hash_keys: &[Variable], max_out: usize, cursor: JoinCursor, build: &mut Option<JoinBuild>, ) -> Result<(Self, Option<JoinCursor>), ComputeError>
Probe self (left) against right for at most max_out output rows,
resuming at cursor. Builds the right HT into build when that slot is
empty; later pulls reuse it. None next-cursor means this left×right
pair is done.
Sourcepub fn shuffle_join(
&self,
right: &Self,
hash_keys: &[Variable],
) -> Result<Self, ComputeError>
pub fn shuffle_join( &self, right: &Self, hash_keys: &[Variable], ) -> Result<Self, ComputeError>
Shuffle join: hash-partition both sides then join per bucket (Phase 9b).
Sourcepub fn union(self, right: Self) -> Result<Self, ComputeError>
pub fn union(self, right: Self) -> Result<Self, ComputeError>
SPARQL UNION: multiset concat after aligning to the name-union schema.
Variables present on only one side are unbound (None) on rows from the
other side. Column order is left-first, then right-only names.
A parked operand keeps its page files when the two schemas already
match; when they do not, both sides hydrate and the result is an in-RAM
table. Row order across a parked pair is unspecified — the row multiset
is exactly left ++ right, but a non-empty left-hand RAM tail is
emitted after the right-hand page files, because the tail is
structurally the table’s last segment.
Sourcepub fn concat(self, other: Self) -> Result<Self, ComputeError>
pub fn concat(self, other: Self) -> Result<Self, ComputeError>
Concatenate two solution sets that share a schema (batch refill).
The schemas must match exactly — the same variables in the same column
order. A caller whose arms may differ wants Self::union, which
widens the schema and pads missing columns as unbound; reaching this
with mismatched schemas is a caller bug, so it is reported rather than
repaired.
“Share a schema” is about the column layout, not residency: either side
may be parked, and a same-schema parked pair merges through the parked
road (which may hydrate a side). Row order across a parked pair is
unspecified — see Self::union.
Sourcepub fn slice_rows(
&self,
start: usize,
length: Option<usize>,
) -> Result<Self, ComputeError>
pub fn slice_rows( &self, start: usize, length: Option<usize>, ) -> Result<Self, ComputeError>
SPARQL Slice: drop start rows, then keep length (None = the rest).
Exact-range random access: returns exactly
min(length, len - start) rows — never fewer while the range is
non-empty. On a parked table this hydrates: the first call reads
every spill page into RAM (cached on the table), so later calls are
free but the memory is already spent.
Misuse hazard: do not call this per-pull to page through a parked
table (an OpenNode-style cursor). One call materializes the whole
input just to serve one page — the full-hydration bug class the spill
layer exists to prevent. Bounded paging belongs to
[crate::spill::take_slice], which returns at most length rows
without hydrating; that function has the opposite contract, so read
its doc before swapping the two.
Sourcepub fn apply_distinct(
&self,
state: &mut DistinctState,
keys: &[Variable],
) -> Result<Self, ComputeError>
pub fn apply_distinct( &self, state: &mut DistinctState, keys: &[Variable], ) -> Result<Self, ComputeError>
SPARQL DISTINCT: keep first-seen rows on keys (SELECT projection).
Missing keys are treated as unbound in every row. Extra non-key columns
are carried from the kept input rows.
Sourcepub fn gather(&self, indices: &[usize]) -> Result<Self, ComputeError>
pub fn gather(&self, indices: &[usize]) -> Result<Self, ComputeError>
Gather rows by index (used by FILTER).
Sourcepub fn any_bound(&self, variable: &Variable) -> Result<bool, ComputeError>
pub fn any_bound(&self, variable: &Variable) -> Result<bool, ComputeError>
Whether any row binds variable (false when this table does
not carry it). One short-circuiting id scan — the join filter
emptiness gates ask exactly this, without
Self::distinct_values’s dedupe + promotion pipeline.
Bound is the id-level definition: a cell is bound iff its id is
non-zero, and every column id was interned in this table’s own
dict by construction, so id != 0 is exactly the boundness
distinct_values reported — no dict lookup is needed to
confirm it.
Sourcepub fn distinct_values(
&self,
variable: &Variable,
) -> Result<Vec<EncodedTerm>, ComputeError>
pub fn distinct_values( &self, variable: &Variable, ) -> Result<Vec<EncodedTerm>, ComputeError>
Distinct bound values of variable across all rows.
Sourcepub fn distinct_count(&self, variable: &Variable) -> Result<usize, ComputeError>
pub fn distinct_count(&self, variable: &Variable) -> Result<usize, ComputeError>
Number of distinct bound values of variable (unbound cells skipped).
Same id-scan as Self::distinct_values without resolving terms.
Trait Implementations§
Source§impl Clone for EncodedSolutions
impl Clone for EncodedSolutions
Source§impl Debug for EncodedSolutions
impl Debug for EncodedSolutions
Source§impl PartialEq for EncodedSolutions
impl PartialEq for EncodedSolutions
Auto Trait Implementations§
impl Freeze for EncodedSolutions
impl RefUnwindSafe for EncodedSolutions
impl Send for EncodedSolutions
impl Sync for EncodedSolutions
impl Unpin for EncodedSolutions
impl UnsafeUnpin for EncodedSolutions
impl UnwindSafe for EncodedSolutions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].