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

Method perform_inlining

src/expr/src/linear.rs:1321–1342  ·  view source on GitHub ↗

Inlines those expressions that are indicated by should_inline. See `inline_expressions` for usage.

(&mut self, should_inline: Vec<bool>)

Source from the content-addressed store, hash-verified

1319 /// Inlines those expressions that are indicated by should_inline.
1320 /// See `inline_expressions` for usage.
1321 pub fn perform_inlining(&mut self, should_inline: Vec<bool>) {
1322 for index in 0..self.expressions.len() {
1323 let (prior, expr) = self.expressions.split_at_mut(index);
1324 expr[0].visit_mut_post(&mut |e| {
1325 if let Some(i) = e.as_column() {
1326 if should_inline[i] {
1327 *e = prior[i - self.input_arity].clone();
1328 }
1329 }
1330 });
1331 }
1332 for (_index, pred) in self.predicates.iter_mut() {
1333 let expressions = &self.expressions;
1334 pred.visit_mut_post(&mut |e| {
1335 if let Some(i) = e.as_column() {
1336 if should_inline[i] {
1337 *e = expressions[i - self.input_arity].clone();
1338 }
1339 }
1340 });
1341 }
1342 }
1343
1344 /// Removes unused expressions from `self.expressions`.
1345 ///

Callers 2

inline_expressionsMethod · 0.80

Calls 4

visit_mut_postMethod · 0.80
as_columnMethod · 0.80
lenMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected