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

Function test_mfp

src/expr/tests/test_runner.rs:83–106  ·  view source on GitHub ↗

Builds a [MapFilterProject] of a certain arity, then modifies it. The test syntax is ` [ ]` The syntax for a command is ` [ ]`

(s: &str)

Source from the content-addressed store, hash-verified

81 /// The test syntax is `<input_arity> [<commands>]`
82 /// The syntax for a command is `<name_of_command> [<args>]`
83 fn test_mfp(s: &str) -> Result<MapFilterProject, String> {
84 let mut input_stream = tokenize(s)?.into_iter();
85 let mut ctx = MirScalarExprDeserializeContext::default();
86 let input_arity = input_stream
87 .next()
88 .unwrap()
89 .to_string()
90 .parse::<usize>()
91 .map_err_to_string_with_causes()?;
92 let mut mfp = MapFilterProject::new(input_arity);
93 while let Some(command) = deserialize_optional::<MFPTestCommand, _, _>(
94 &mut input_stream,
95 "MFPTestCommand",
96 &mut ctx,
97 )? {
98 match command {
99 MFPTestCommand::Map(map) => mfp = mfp.map(map),
100 MFPTestCommand::Filter(filter) => mfp = mfp.filter(filter),
101 MFPTestCommand::Project(project) => mfp = mfp.project(project),
102 MFPTestCommand::Optimize => mfp.optimize(),
103 }
104 }
105 Ok(mfp)
106 }
107
108 fn test_canonicalize_equiv(s: &str) -> Result<Vec<Vec<MirScalarExpr>>, String> {
109 let mut input_stream = tokenize(s)?.into_iter();

Callers 1

runFunction · 0.70

Calls 10

unwrapMethod · 0.80
tokenizeFunction · 0.50
into_iterMethod · 0.45
to_stringMethod · 0.45
nextMethod · 0.45
mapMethod · 0.45
filterMethod · 0.45
projectMethod · 0.45
optimizeMethod · 0.45

Tested by

no test coverage detected