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,
)
| 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 | /// |
nothing calls this directly
no test coverage detected