Skip to main content

PlanWarning

Enum PlanWarning 

Source
pub enum PlanWarning {
    EstimationMiss,
    CartesianProduct,
    AllNodesScan,
    LabelDisjunctionScan {
        indexes: String,
    },
}
Expand description

One typed warning a plan node carries (ADR-0344, typed node warnings): the vocabulary’s one definition — the wire name it serializes by, the message text that renders beside the affected operator and in the warnings footer, the payload variant that names the property index, and the notification kind it projects to (ADR-0363 decision 1) — each owned here once, beside the notification vocabulary it projects into, so the engine’s detection, the wire parse, and every surface’s rendering cannot drift (LABS-461: one warning type, not three coordinated layers).

The engine constructs the variants at plan-tree construction (the MATCH-shape detection in relate’s plan_node/warning.rs); the wire accessor parses the {name, index} maps back into them — the one typed vocabulary in both directions.

let cartesian = PlanWarning::CartesianProduct;
assert_eq!(cartesian.name(), "CartesianProduct");
assert_eq!(
    cartesian.message(),
    "the MATCH patterns share no join anchor"
);
// The AllNodesScan warning names no index: a label-less pattern
// cannot use one, so the advice is the label.
let scan = PlanWarning::AllNodesScan;
assert_eq!(scan.name(), "AllNodesScan");
assert_eq!(
    scan.message(),
    "the scan matches every node; add a label to narrow it"
);
// The label-disjunction scan carries the per-label pairs its own
// predicate wants indexed (LABS-1083).
let disjunction = PlanWarning::LabelDisjunctionScan {
    indexes: ":Model(id), :Source(id)".to_string(),
};
assert_eq!(disjunction.name(), "LabelDisjunctionScan");
assert_eq!(
    disjunction.message(),
    "the disjunction scan answers per label; consider the property index \
     (:Model(id), :Source(id))"
);

Variants§

§

EstimationMiss

The operator’s estimate overshot its actual rows by 10x or more — the same policy the ratio cell’s ! marker reads. PROFILE only: it needs the actual rows, so it never fires on an EXPLAIN tree.

§

CartesianProduct

A multi-pattern MATCH whose patterns share no join anchor (no node variable appears in more than one pattern) — the patterns multiply instead of joining.

§

AllNodesScan

A label-less scan (MATCH (n)) while the store carries a property index. The warning names no index: no property index serves a pattern without a label, and the one the store carries may be unrelated to the query, so the advice is the label alone.

§

LabelDisjunctionScan

A static label disjunction no seek serves (MATCH (p) WHERE p:Model OR p:Source after the planner’s fold, LABS-1083): the scan answers per disjunct label, never every node — its own warning shape, never the AllNodesScan text. The warning carries the per-label :Label(property) pairs its equality predicate wants indexed, comma-joined, as the suggestion.

Fields

§indexes: String

The per-label index pairs the suggestion names.

Implementations§

Source§

impl PlanWarning

Source

pub fn name(&self) -> &'static str

The warning’s wire name — the one spelling the wire form serializes (warnings on the node) and Self::from_wire_parts validates against.

Source

pub fn suggested_index(&self) -> Option<&str>

The warning’s index payload — the LabelDisjunctionScan warning’s per-label index pairs, None on the payload-less variants. The one spelling of which warnings carry a payload, read by both the message text and the wire form’s index field, so the vocabulary is matched once.

Source

pub fn notification_kind(&self) -> NotificationKind

The notification kind this warning projects to (ADR-0363 decision 1) — from the one exhaustive variant mapping Self::name reads, so a fourth warning variant must choose its vocabulary row there rather than falling through a wildcard.

assert_eq!(
    PlanWarning::CartesianProduct.notification_kind(),
    NotificationKind::CartesianProduct
);
assert!(PlanWarning::EstimationMiss
    .notification_kind()
    .is_plan_warning());
Source

pub fn message(&self) -> String

The warning’s message text — the vocabulary’s base text (Self::vocabulary’s one spelling), with the payload appended in parentheses when the warning carries one (the LabelDisjunctionScan warning’s suggested index pairs). The one spelling the engine renderer and every surface’s table layout render, so the text cannot drift between the forms.

Trait Implementations§

Source§

impl Clone for PlanWarning

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PlanWarning

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for PlanWarning

Source§

impl PartialEq for PlanWarning

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PlanWarning

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.