| 138 | |
| 139 | #[allow(clippy::disallowed_types)] |
| 140 | fn handle_apply( |
| 141 | catalog: &TestCatalog, |
| 142 | input: &str, |
| 143 | args: &std::collections::HashMap<String, Vec<String>>, |
| 144 | ) -> String { |
| 145 | let Some(pipeline) = args.get("pipeline") else { |
| 146 | return "missing required `pipeline` argument for `apply` directive".to_string(); |
| 147 | }; |
| 148 | |
| 149 | if pipeline.len() != 1 { |
| 150 | return "unexpected `pipeline` arguments for `apply` directive".to_string(); |
| 151 | } |
| 152 | |
| 153 | let result = match pipeline[0].as_str() { |
| 154 | // Pseudo-transforms. |
| 155 | "identity" => { |
| 156 | // noop |
| 157 | let transform = Identity::default(); |
| 158 | apply_transform(transform, catalog, input) |
| 159 | } |
| 160 | // Actual transforms. |
| 161 | "anf" => { |
| 162 | use mz_transform::cse::anf::ANF; |
| 163 | let transform = ANF::default(); |
| 164 | apply_transform(transform, catalog, input) |
| 165 | } |
| 166 | "equivalence_propagation" => { |
| 167 | use mz_transform::equivalence_propagation::EquivalencePropagation; |
| 168 | let transform = EquivalencePropagation::default(); |
| 169 | apply_transform(transform, catalog, input) |
| 170 | } |
| 171 | "flat_map_elimination" => { |
| 172 | use mz_transform::canonicalization::FlatMapElimination; |
| 173 | let transform = FlatMapElimination; |
| 174 | apply_transform(transform, catalog, input) |
| 175 | } |
| 176 | "fold_constants" => { |
| 177 | use mz_transform::fold_constants::FoldConstants; |
| 178 | let transform = FoldConstants { limit: None }; |
| 179 | apply_transform(transform, catalog, input) |
| 180 | } |
| 181 | "fusion_join" => { |
| 182 | use mz_transform::fusion::join::Join; |
| 183 | let transform = Join; |
| 184 | apply_transform(transform, catalog, input) |
| 185 | } |
| 186 | "fusion_top_k" => { |
| 187 | use mz_transform::fusion::top_k::TopK; |
| 188 | let transform = TopK; |
| 189 | apply_transform(transform, catalog, input) |
| 190 | } |
| 191 | "literal_lifting" => { |
| 192 | use mz_transform::literal_lifting::LiteralLifting; |
| 193 | let transform = LiteralLifting::default(); |
| 194 | apply_transform(transform, catalog, input) |
| 195 | } |
| 196 | "non_null_requirements" => { |
| 197 | use mz_transform::non_null_requirements::NonNullRequirements; |