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

Method transform

src/transform/src/lib.rs:219–243  ·  view source on GitHub ↗

Transforms a relation into a functionally equivalent relation. This is a wrapper around `actually_perform_transform` that also measures the time taken and updates the optimizer metrics.

(
        &self,
        relation: &mut MirRelationExpr,
        args: &mut TransformCtx,
    )

Source from the content-addressed store, hash-verified

217 /// This is a wrapper around `actually_perform_transform` that also
218 /// measures the time taken and updates the optimizer metrics.
219 fn transform(
220 &self,
221 relation: &mut MirRelationExpr,
222 args: &mut TransformCtx,
223 ) -> Result<(), TransformError> {
224 let hash_before = args
225 .global_id
226 .and_then(|id| args.last_hash.get(&id).copied())
227 .unwrap_or_else(|| relation.hash_to_u64());
228
229 mz_ore::soft_assert_eq_no_log!(hash_before, relation.hash_to_u64(), "cached hash clash");
230 // actually run the transform, recording the time taken
231 let start = std::time::Instant::now();
232 let res = self.actually_perform_transform(relation, args);
233 let duration = start.elapsed();
234
235 let hash_after = args.update_last_hash(relation);
236 if let Some(metrics) = &mut args.metrics {
237 let transform_name = self.name();
238 metrics.observe_transform_time(transform_name, duration);
239 metrics.inc_transform(hash_before != hash_after, transform_name);
240 }
241
242 res
243 }
244
245 /// Transform a relation into a functionally equivalent relation.
246 ///

Callers

nothing calls this directly

Implementers 15

case_literal.rssrc/transform/src/case_literal.rs
equivalence_propagation.rssrc/transform/src/equivalence_propagat
canonicalize_mfp.rssrc/transform/src/canonicalize_mfp.rs
reduce_elision.rssrc/transform/src/reduce_elision.rs
lib.rssrc/transform/src/lib.rs
typecheck.rssrc/transform/src/typecheck.rs
redundant_join.rssrc/transform/src/redundant_join.rs
literal_lifting.rssrc/transform/src/literal_lifting.rs
literal_constraints.rssrc/transform/src/literal_constraints.
canonicalization.rssrc/transform/src/canonicalization.rs
non_null_requirements.rssrc/transform/src/non_null_requirement
fold_constants.rssrc/transform/src/fold_constants.rs

Calls 8

nowFunction · 0.85
hash_to_u64Method · 0.80
update_last_hashMethod · 0.80
inc_transformMethod · 0.80
getMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected