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

Function apply_transform

src/transform/tests/test_transforms.rs:267–297  ·  view source on GitHub ↗
(
    transform: T,
    catalog: &TestCatalog,
    input: &str,
)

Source from the content-addressed store, hash-verified

265}
266
267fn 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
299fn parse_explain_config(mut flags: BTreeSet<String>) -> Result<ExplainConfig, String> {
300 let result = ExplainConfig {

Callers 1

handle_applyFunction · 0.70

Calls 4

try_parse_mirFunction · 0.85
transformMethod · 0.45
debug_explainMethod · 0.45

Tested by

no test coverage detected