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

Function optimize_orders

src/transform/src/join_implementation.rs:1010–1031  ·  view source on GitHub ↗

Computes the best join orders for each input. If there are N inputs, returns N orders, with the ith input starting the ith order.

(
    equivalences: &[Vec<MirScalarExpr>], // join equivalences: inside a Vec, the exprs are equivalent
    available: &[Vec<Vec<MirScalarExpr>>], // available arrangements per input
    unique_keys: 

Source from the content-addressed store, hash-verified

1008//
1009// If there are N inputs, returns N orders, with the ith input starting the ith order.
1010fn optimize_orders(
1011 equivalences: &[Vec<MirScalarExpr>], // join equivalences: inside a Vec, the exprs are equivalent
1012 available: &[Vec<Vec<MirScalarExpr>>], // available arrangements per input
1013 unique_keys: &[Vec<Vec<usize>>], // unique keys per input
1014 cardinalities: &[Option<usize>], // cardinalities of input relations
1015 filters: &[FilterCharacteristics], // filter characteristics per input
1016 input_mapper: &JoinInputMapper, // join helper
1017 enable_join_prioritize_arranged: bool,
1018) -> Result<Vec<Vec<(JoinInputCharacteristics, Vec<MirScalarExpr>, usize)>>, TransformError> {
1019 let mut orderer = Orderer::new(
1020 equivalences,
1021 available,
1022 unique_keys,
1023 cardinalities,
1024 filters,
1025 input_mapper,
1026 enable_join_prioritize_arranged,
1027 );
1028 (0..available.len())
1029 .map(move |i| orderer.optimize_order_for(i))
1030 .collect::<Result<Vec<_>, _>>()
1031}
1032
1033struct Orderer<'a> {
1034 inputs: usize,

Callers 1

planFunction · 0.85

Calls 3

optimize_order_forMethod · 0.80
mapMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected