Skip to main content

MergeShape

Enum MergeShape 

Source
#[non_exhaustive]
pub enum MergeShape { Merge(MergeRestrictions), Upsert(UpsertForm), InsertDedup(InsertDedup), Unsupported(&'static str), None, }
Expand description

How this engine performs the upsert Razeri’s load is.

The default is MergeShape::None: an engine Razeri has not been told about gets a refusal rather than another vendor’s statement.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Merge(MergeRestrictions)

MERGE INTO … USING … WHEN MATCHED … WHEN NOT MATCHED …, with whatever this engine’s MERGE will not do.

§

Upsert(UpsertForm)

No MERGE; this engine has an upsert statement of its own.

§

InsertDedup(InsertDedup)

No upsert statement at all — the TABLE ENGINE deduplicates, and the composed load leans into that instead of borrowing a grammar.

The load is a plain INSERT … SELECT; rows that share the target’s sorting key collapse in the engine’s background merges, the greatest value of InsertDedup::version_column deciding the survivor; and a read that needs the collapsed answer now says InsertDedup::final_read_modifier. Razeri’s deterministic surrogate key is what makes this sound: re-inserting a member computes the same key every time, so there is no lookup and no identity race — the two halves an upsert statement exists to coordinate.

This composes a load (MergeShape::composes_a_load is true), and it is still not a MERGE: MergeShape::merges stays false, so every statement family that needs a real MERGE — the single-WHEN identity sync included — takes its join-based spelling here, never a correlated one. The engine that carries this shape refuses correlated subqueries outright, which is measured, not assumed.

§

Unsupported(&'static str)

Neither, measured — and this engine’s own sentence about it.

Razeri composes no load here, and the string is what the reader gets instead: it lands in the generated loads.sql where the load would have been, so it is the only thing an operator has to act on. Write it fix-first — what this engine offers instead before what it lacks, and name the near form, because a near form the reader will find alone is the thing that costs them a day.

It is prose that lands inside a SQL comment, so it must never spell a complete statement.

§

None

The dialect has not answered.

Razeri refuses rather than emitting a statement from a different vendor’s grammar, and the conformance kit reports the silence. A dialect whose engine really has neither says so with MergeShape::Unsupported, which is a claim rather than a silence and carries the words to prove it.

Implementations§

Source§

impl MergeShape

Source

pub const fn merges(&self) -> bool

Whether Razeri’s two-clause core load can be a MERGE here.

Source

pub const fn merges_a_single_when_clause(&self) -> bool

Whether a one-clause MERGE runs here — the identity load’s shape.

An engine with MERGE can still answer no, and one does.

Source

pub const fn slice_predicate_needs_a_literal(&self) -> bool

Whether the day a scoped load is given has to reach this engine as a literal for it to read that day’s partition instead of all of them.

false is the ordinary answer: the parameter the caller binds to the load procedure is constant enough for the planner. A shape that is not a MERGE answers false as well — it carries no restrictions, and Razeri binds the day rather than formatting it in.

Source

pub const fn upsert_form(&self) -> Option<UpsertForm>

The engine’s own upsert statement, where it has one instead of MERGE.

Source

pub const fn insert_dedup(&self) -> Option<InsertDedup>

The insert-and-deduplicate composition, where the table engine is the upsert — see MergeShape::InsertDedup.

Source

pub const fn refusal(&self) -> Option<&'static str>

Why Razeri cannot compose a load here, in words, or None if it can. The sentence is the one a reader acts on.

The one accessor every surface reads — the materializer that declines to compose the load, and the loads.sql that says so where an operator opens it — so neither one holds a second copy of the words.

Source

pub const fn composes_a_load(&self) -> bool

Whether Razeri composes a load for this engine at all.

The one question the materializer asks before it builds the load procedures — asked of the shape, never of a dialect’s name.

Trait Implementations§

Source§

impl Clone for MergeShape

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 Copy for MergeShape

Source§

impl Debug for MergeShape

Source§

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

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

impl Default for MergeShape

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for MergeShape

Source§

impl PartialEq for MergeShape

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 MergeShape

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<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.