(
transform: T,
catalog: &TestCatalog,
input: &str,
)
| 265 | } |
| 266 | |
| 267 | fn apply_transform<T: mz_transform::Transform>( |
| 268 | transform: T, |
| 269 | catalog: &TestCatalog, |
| 270 | input: &str, |
| 271 | ) -> Result<String, String> { |
| 272 | // Parse the relation, returning early on parse error. |
| 273 | let mut relation = try_parse_mir(catalog, input)?; |
| 274 | |
| 275 | let mut features = mz_repr::optimize::OptimizerFeatures::default(); |
| 276 | // Apply a non-default feature flag to test the right implementation. |
| 277 | features.enable_letrec_fixpoint_analysis = true; |
| 278 | features.enable_dequadratic_eqprop_map = true; |
| 279 | features.enable_eq_classes_withholding_errors = true; |
| 280 | let typecheck_ctx = mz_transform::typecheck::empty_typechecking_context(); |
| 281 | let mut df_meta = DataflowMetainfo::default(); |
| 282 | let mut transform_ctx = mz_transform::TransformCtx::local( |
| 283 | &features, |
| 284 | &typecheck_ctx, |
| 285 | &mut df_meta, |
| 286 | None, |
| 287 | Some(TEST_GLOBAL_ID), |
| 288 | ); |
| 289 | |
| 290 | // Apply the transformation, returning early on TransformError. |
| 291 | transform |
| 292 | .transform(&mut relation, &mut transform_ctx) |
| 293 | .map_err(|e| format!("{}\n", e.to_string().trim()))?; |
| 294 | |
| 295 | // Serialize and return the transformed relation. |
| 296 | Ok(relation.debug_explain(&ExplainConfig::default(), Some(catalog))) |
| 297 | } |
| 298 | |
| 299 | fn parse_explain_config(mut flags: BTreeSet<String>) -> Result<ExplainConfig, String> { |
| 300 | let result = ExplainConfig { |
no test coverage detected