pub struct QueryEngine<H, R> { /* private fields */ }Expand description
SPARQL coordinator over the hexastore and registry endpoints.
Implementations§
Source§impl<H, R> QueryEngine<H, R>
impl<H, R> QueryEngine<H, R>
Sourcepub fn new(
hexastore: H,
registry: R,
router: Router,
retry: RetryPolicy,
) -> Self
pub fn new( hexastore: H, registry: R, router: Router, retry: RetryPolicy, ) -> Self
Build over injected clients (mocks in unit tests; tonic in integration).
Sourcepub fn default_union(&self) -> bool
pub fn default_union(&self) -> bool
SPARQL default-graph fallback copied onto QueryContext.
Sourcepub fn set_default_union(&mut self, default_union: bool)
pub fn set_default_union(&mut self, default_union: bool)
Set the SPARQL default-graph fallback (false = RDF unnamed graph only).
Sourcepub fn set_seat_by_total_cost(&mut self, seat_by_total_cost: bool)
pub fn set_seat_by_total_cost(&mut self, seat_by_total_cost: bool)
Seat inner joins by the total seating cost (false = legacy
driver_cost comparator; the shadow log is unaffected).
Sourcepub fn seat_by_total_cost(&self) -> bool
pub fn seat_by_total_cost(&self) -> bool
Inner-join seating comparator currently configured.
Sourcepub fn set_force_semi(&mut self, force_semi: bool)
pub fn set_force_semi(&mut self, force_semi: bool)
Benchmark switch: force Semi past a PerPage cost verdict.
Sourcepub fn eager_scan_filter(&self) -> bool
pub fn eager_scan_filter(&self) -> bool
Whether scans stamp and apply slot comparisons.
Sourcepub fn set_eager_scan_filter(&mut self, enabled: bool)
pub fn set_eager_scan_filter(&mut self, enabled: bool)
Test/benchmark switch for slot comparison pushdown and the eager scan filter. Production leaves it on; the equivalence battery turns it off to prove identical answers, and a benchmark uses it for the on/off delta. Off is the pre-feature path: nothing is stamped, so no comparison reaches the wire and every conjunct stays in the plan.
Sourcepub fn with_default_union(self, default_union: bool) -> Self
pub fn with_default_union(self, default_union: bool) -> Self
Builder: SPARQL default-graph fallback.
Sourcepub fn geo_index_epoch(&self) -> Option<u64>
pub fn geo_index_epoch(&self) -> Option<u64>
Geo-index rebuild epoch copied onto QueryContext.
Sourcepub fn set_geo_index_epoch(&mut self, geo_index_epoch: Option<u64>)
pub fn set_geo_index_epoch(&mut self, geo_index_epoch: Option<u64>)
Set the geo-index rebuild epoch (None = trusted).
Sourcepub fn with_geo_index_epoch(self, geo_index_epoch: Option<u64>) -> Self
pub fn with_geo_index_epoch(self, geo_index_epoch: Option<u64>) -> Self
Builder: geo-index rebuild epoch (None = trusted).
Sourcepub fn temporal_index_epoch(&self) -> Option<u64>
pub fn temporal_index_epoch(&self) -> Option<u64>
Temporal-index rebuild epoch copied onto QueryContext.
Sourcepub fn set_temporal_index_epoch(&mut self, temporal_index_epoch: Option<u64>)
pub fn set_temporal_index_epoch(&mut self, temporal_index_epoch: Option<u64>)
Set the temporal-index rebuild epoch (None = untrusted).
Sourcepub fn with_temporal_index_epoch(
self,
temporal_index_epoch: Option<u64>,
) -> Self
pub fn with_temporal_index_epoch( self, temporal_index_epoch: Option<u64>, ) -> Self
Builder: temporal-index rebuild epoch (None = untrusted).
Sourcepub fn text_index_epoch(&self) -> Option<u64>
pub fn text_index_epoch(&self) -> Option<u64>
Text-index rebuild epoch copied onto QueryContext (None = untrusted).
Sourcepub fn set_text_index_state(
&mut self,
epoch: Option<u64>,
fingerprint: impl Into<Arc<str>>,
)
pub fn set_text_index_state( &mut self, epoch: Option<u64>, fingerprint: impl Into<Arc<str>>, )
Set the text-index rebuild epoch and fingerprint.
Sourcepub fn with_text_index_state(
self,
epoch: Option<u64>,
fingerprint: impl Into<Arc<str>>,
) -> Self
pub fn with_text_index_state( self, epoch: Option<u64>, fingerprint: impl Into<Arc<str>>, ) -> Self
Builder: text-index rebuild epoch + fingerprint (None = untrusted).
Sourcepub fn spill_root(&self) -> Option<&Path>
pub fn spill_root(&self) -> Option<&Path>
Spill root copied onto QueryContext (None = std::env::temp_dir).
Sourcepub fn set_spill_root(&mut self, spill_root: Option<PathBuf>)
pub fn set_spill_root(&mut self, spill_root: Option<PathBuf>)
Set the spill root copied onto each QueryContext.
Sourcepub fn with_spill_root(self, spill_root: Option<PathBuf>) -> Self
pub fn with_spill_root(self, spill_root: Option<PathBuf>) -> Self
Builder: spill root copied onto each QueryContext.
Sourcepub fn context(&self, snapshot: SnapshotId) -> QueryContext
pub fn context(&self, snapshot: SnapshotId) -> QueryContext
Per-query context with this engine’s default_union, spill root,
index epochs, and snapshot.
Sourcepub fn path_pair_budget(&self) -> u64
pub fn path_pair_budget(&self) -> u64
Distinct-pair circuit breaker for bound / one-end property paths.
Sourcepub fn set_path_pair_budget(&mut self, budget: u64)
pub fn set_path_pair_budget(&mut self, budget: u64)
Set the distinct-pair circuit breaker (default PATH_PAIR_BUDGET).
Sourcepub fn open_star_pair_budget(&self) -> u64
pub fn open_star_pair_budget(&self) -> u64
Distinct-pair circuit breaker for * / + with no LIMIT.
Sourcepub fn set_open_star_pair_budget(&mut self, budget: u64)
pub fn set_open_star_pair_budget(&mut self, budget: u64)
Set the open-* / + pair budget (default OPEN_STAR_PAIR_BUDGET).
Sourcepub fn describe_mode(&self) -> DescribeMode
pub fn describe_mode(&self) -> DescribeMode
DESCRIBE algorithm used by Self::query.
Sourcepub fn set_describe_mode(&mut self, mode: DescribeMode)
pub fn set_describe_mode(&mut self, mode: DescribeMode)
Set the DESCRIBE algorithm (star default).
Sourcepub fn with_describe_mode(self, mode: DescribeMode) -> Self
pub fn with_describe_mode(self, mode: DescribeMode) -> Self
Builder: set the DESCRIBE algorithm.
Sourcepub fn set_profile(&self, profile: StatsProfile)
pub fn set_profile(&self, profile: StatsProfile)
Replace the local sketch cache (tests / in-process push). The
whole [EngineProfile] is swapped as one new inner Arc — snapshots
taken by outstanding queries keep planning against the generation
they saw.
Sourcepub fn profile(&self) -> StatsProfile
pub fn profile(&self) -> StatsProfile
Snapshot of the local sketch cache (an owned deep copy — admin and
EXPLAIN paths, not the per-query hot path; see Self::engine_profile).
Source§impl QueryEngine<GrpcHexastoreClients, GrpcRegistryClients>
impl QueryEngine<GrpcHexastoreClients, GrpcRegistryClients>
Sourcepub async fn connect(
config: &ClusterConfig,
retry: RetryPolicy,
) -> Result<Self, ComputeError>
pub async fn connect( config: &ClusterConfig, retry: RetryPolicy, ) -> Result<Self, ComputeError>
Connect tonic clients for every address in config.
Source§impl<H: HexastoreStats, R> QueryEngine<H, R>
impl<H: HexastoreStats, R> QueryEngine<H, R>
Sourcepub async fn refresh_stats(&self) -> Result<StatsProfile, ComputeError>
pub async fn refresh_stats(&self) -> Result<StatsProfile, ComputeError>
Pull shard profiles from S/P/O and roll up into the local cache.
Because writes fan out to all three axes, roll-up prefers the O profile rather than summing replicas. Named-graph count is taken from S. The result is re-capped so a future with several same-axis shard profiles (whose merge could union two capped HLL sets) still keeps the planner cache bounded.
Source§impl<H: HexastoreScan + HexastoreCatalog + HexastoreGeo, R: StringResolve + BlobStoreClient> QueryEngine<H, R>
impl<H: HexastoreScan + HexastoreCatalog + HexastoreGeo, R: StringResolve + BlobStoreClient> QueryEngine<H, R>
Sourcepub async fn query(
&self,
sparql: &str,
ctx: &QueryContext,
) -> Result<QueryResults, ComputeError>
pub async fn query( &self, sparql: &str, ctx: &QueryContext, ) -> Result<QueryResults, ComputeError>
Parse, plan, execute, and materialize a SPARQL SELECT, ASK, CONSTRUCT, or DESCRIBE.
The execution dataset is QueryDataset::resolve of ctx protocol
graph IRIs, the query’s FROM / FROM NAMED clause, and
QueryContext::default_union. A dataset already stored on ctx is
replaced.
Sourcepub async fn query_output(
&self,
sparql: &str,
ctx: &QueryContext,
) -> Result<QueryOutput, ComputeError>
pub async fn query_output( &self, sparql: &str, ctx: &QueryContext, ) -> Result<QueryOutput, ComputeError>
Parse, plan, execute, and late-materialize SPARQL results.
SELECT returns encoded projected columns plus the interned string map
from a registry resolve — not decoded oxrdf [Term]s. ASK / CONSTRUCT /
DESCRIBE return QueryOutput::Ready.
The execution dataset is QueryDataset::resolve of ctx protocol
graph IRIs, the query’s FROM / FROM NAMED clause, and
QueryContext::default_union. A dataset already stored on ctx is
replaced.
Sourcepub async fn quad_count(
&self,
snapshot: SnapshotId,
) -> Result<u64, ComputeError>
pub async fn quad_count( &self, snapshot: SnapshotId, ) -> Result<u64, ComputeError>
Count quads visible as of snapshot (unbound S/SPOG prefix count).
Counts the default graph on the S axis. The partition walks SPOG locally and returns a single integer; matching quads are not sent to compute.
Sourcepub async fn count_encoded_pattern(
&self,
pattern: &EncodedTriplePattern,
snapshot: SnapshotId,
axis: PartitionAxis,
permutation: Option<IndexPermutation>,
) -> Result<u64, ComputeError>
pub async fn count_encoded_pattern( &self, pattern: &EncodedTriplePattern, snapshot: SnapshotId, axis: PartitionAxis, permutation: Option<IndexPermutation>, ) -> Result<u64, ComputeError>
Count quads matching pattern on axis without returning rows.
Sourcepub async fn execute(
&self,
plan: &LogicalPlan,
ctx: &QueryContext,
) -> Result<EncodedSolutions, ComputeError>
pub async fn execute( &self, plan: &LogicalPlan, ctx: &QueryContext, ) -> Result<EncodedSolutions, ComputeError>
Run a planned query, stopping before string materialization.
The plan and ctx must agree on whether the eager scan filter runs:
planning deletes exact FILTER conjuncts into the scans’ comparisons
when it runs, so a plan built that way cannot be executed with the
filter switched off. Plan under the executing context
(LogicalPlan::parse_with_context) when the filter setting differs
from the planner default.
Sourcepub async fn resolve_projection(
&self,
projection: &[Variable],
solutions: &EncodedSolutions,
ctx: &QueryContext,
cache: &QueryCaches,
) -> Result<ProjectedSolutions, ComputeError>
pub async fn resolve_projection( &self, projection: &[Variable], solutions: &EncodedSolutions, ctx: &QueryContext, cache: &QueryCaches, ) -> Result<ProjectedSolutions, ComputeError>
Resolve unique projected hashes, then drop unprojected join-key columns.
This is the registry RPC half of late materialization. HTTP serializes
from the returned map; Self::materialize still decodes into owned
[Term]s for query() / CLI / compliance.
Sourcepub async fn materialize(
&self,
projection: &[Variable],
solutions: &EncodedSolutions,
ctx: &QueryContext,
cache: &QueryCaches,
) -> Result<QueryResults, ComputeError>
pub async fn materialize( &self, projection: &[Variable], solutions: &EncodedSolutions, ctx: &QueryContext, cache: &QueryCaches, ) -> Result<QueryResults, ComputeError>
Resolve the hashes of projected columns and rebuild oxrdf terms.
Only projected variables reach the registry: intermediate join columns stay encoded for the whole query.
Trait Implementations§
Source§impl<H: Clone, R: Clone> Clone for QueryEngine<H, R>
impl<H: Clone, R: Clone> Clone for QueryEngine<H, R>
Source§fn clone(&self) -> QueryEngine<H, R>
fn clone(&self) -> QueryEngine<H, R>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<H, R> Freeze for QueryEngine<H, R>
impl<H, R> RefUnwindSafe for QueryEngine<H, R>where
H: RefUnwindSafe,
R: RefUnwindSafe,
impl<H, R> Send for QueryEngine<H, R>
impl<H, R> Sync for QueryEngine<H, R>
impl<H, R> Unpin for QueryEngine<H, R>
impl<H, R> UnsafeUnpin for QueryEngine<H, R>where
H: UnsafeUnpin,
R: UnsafeUnpin,
impl<H, R> UnwindSafe for QueryEngine<H, R>where
H: UnwindSafe,
R: UnwindSafe,
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].