MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / join_assign

Method join_assign

src/transform/src/column_knowledge.rs:554–642  ·  view source on GitHub ↗

Unions (weakens) the possible states of a column.

(&mut self, other: &Self)

Source from the content-addressed store, hash-verified

552
553 /// Unions (weakens) the possible states of a column.
554 fn join_assign(&mut self, other: &Self) {
555 use DatumKnowledge::*;
556
557 // Each of the following `if` statements handles the cases marked with
558 // `x` of the (self x other) cross product (depicted as a rows x cols
559 // table where Self::bottom() is the UL and Self::top() the LR corner).
560 // Cases that are already handled are marked with `+` and cases that are
561 // yet to be handled marked with `-`.
562 //
563 // The order of handling (crossing out) of cases ensures that
564 // `*.clone()` is not called unless necessary.
565 //
566 // The final case after the ifs can assert that both sides are Lit
567 // variants.
568
569 // x - - - : Nothing
570 // x - - - : Lit { _, _ }
571 // x - - - : Any { false }
572 // x x x x : Any { true }
573 if crate::any![
574 matches!(self, Any { nullable: true }),
575 matches!(other, Nothing),
576 ] {
577 // Nothing to do.
578 }
579 // + x x x : Nothing
580 // + - - x : Lit { _, _ }
581 // + - - x : Any { false }
582 // + + + + : Any { true }
583 else if crate::any![
584 matches!(self, Nothing),
585 matches!(other, Any { nullable: true }),
586 ] {
587 *self = other.clone();
588 }
589 // + + + + : Nothing
590 // + - - + : Lit { _, _ }
591 // + x x + : Any { false }
592 // + + + + : Any { true }
593 else if matches!(self, Any { nullable: false }) {
594 if !other.nullable() {
595 // Nothing to do.
596 } else {
597 *self = Self::top() // other: Lit { null, _ }
598 }
599 // Nothing to do.
600 }
601 // + + + + : Nothing
602 // + - x + : Lit { _, _ }
603 // + + + + : Any { false }
604 // + + + + : Any { true }
605 else if matches!(other, Any { nullable: false }) {
606 if !self.nullable() {
607 *self = other.clone();
608 } else {
609 *self = Self::top() // other: Lit { null, _ }
610 }
611 }

Callers 15

apply_recMethod · 0.80
update_frontierMethod · 0.80
nextMethod · 0.80
downgrade_sinceMethod · 0.80
reader_heartbeat_taskMethod · 0.80
shard_source_descsFunction · 0.80
begin_mergeMethod · 0.80
overall_descMethod · 0.80
newMethod · 0.80
run_exportMethod · 0.80
handle_commandsFunction · 0.80

Calls 2

cloneMethod · 0.45
nullableMethod · 0.45

Tested by

no test coverage detected