#[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
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
impl MergeShape
Sourcepub const fn merges_a_single_when_clause(&self) -> bool
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.
Sourcepub const fn slice_predicate_needs_a_literal(&self) -> bool
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.
Sourcepub const fn upsert_form(&self) -> Option<UpsertForm>
pub const fn upsert_form(&self) -> Option<UpsertForm>
The engine’s own upsert statement, where it has one instead of MERGE.
Sourcepub const fn insert_dedup(&self) -> Option<InsertDedup>
pub const fn insert_dedup(&self) -> Option<InsertDedup>
The insert-and-deduplicate composition, where the table engine is the
upsert — see MergeShape::InsertDedup.
Sourcepub const fn refusal(&self) -> Option<&'static str>
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.
Sourcepub const fn composes_a_load(&self) -> bool
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.