pub struct BroadcastRuntimeRule { /* private fields */ }Expand description
AQE rule that promotes or demotes broadcast joins based on the observed output size from the previous execution.
BroadcastAutoRule makes a logical-time guess from estimated_rows; this
rule corrects that guess at runtime:
- Promotion: when the observed stage output is at or below
max_broadcast_bytesand a node isbroadcast_eligible()withHashorRoundRobinpartitioning, the node’s partitioning is rewritten toPartitioning::Broadcast, replacing the shuffle with a replicate. - Demotion: when a node is already
Partitioning::Broadcastbut the observed output exceeds the threshold, the broadcast is undone.Partitioning::Broadcastdoes not record the original hash keys, so they cannot be recovered; the node is demoted toPartitioning::RoundRobin { buckets }withbuckets = clamp(ceil(observed / 128 MiB), 2, 64). Round-robin is the semantically safe choice — it makes no key-colocation promise, whereas guessing hash keys could silently mis-distribute keyed data.
Like the other AQE sizing rules, the observed size is the sum over the
per-stage RuntimeStats slice, preferring serialized_bytes (shuffle
wire size) and falling back to memory_bytes when it is zero — the same
convention as AutoPartitionRule.
The rule is intrinsically disabled for streaming plans (changing
partitioning mid-job would orphan keyed state) and returns None when
stats are empty or nothing changes.
Implementations§
Source§impl BroadcastRuntimeRule
impl BroadcastRuntimeRule
Sourcepub fn new(max_broadcast_bytes: u64) -> Self
pub fn new(max_broadcast_bytes: u64) -> Self
Create a new rule with the given broadcast size threshold in bytes.
Use DEFAULT_MAX_BROADCAST_BYTES (64 MiB) for the standard default.
Trait Implementations§
Source§impl AqeRule for BroadcastRuntimeRule
impl AqeRule for BroadcastRuntimeRule
Source§fn apply(
&self,
plan: &PhysicalPlan,
stats: &[RuntimeStats],
) -> Option<PhysicalPlan>
fn apply( &self, plan: &PhysicalPlan, stats: &[RuntimeStats], ) -> Option<PhysicalPlan>
RuntimeStats for each stage. Read moreAuto Trait Implementations§
impl Freeze for BroadcastRuntimeRule
impl RefUnwindSafe for BroadcastRuntimeRule
impl Send for BroadcastRuntimeRule
impl Sync for BroadcastRuntimeRule
impl Unpin for BroadcastRuntimeRule
impl UnsafeUnpin for BroadcastRuntimeRule
impl UnwindSafe for BroadcastRuntimeRule
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request