()
| 5179 | |
| 5180 | #[test] |
| 5181 | fn test_transform_explain() { |
| 5182 | let schema = Schema::new(vec![ |
| 5183 | Field::new("foo", DataType::Int32, false), |
| 5184 | Field::new("bar", DataType::Int32, false), |
| 5185 | ]); |
| 5186 | |
| 5187 | let plan = table_scan(TableReference::none(), &schema, None) |
| 5188 | .unwrap() |
| 5189 | .explain(false, false) |
| 5190 | .unwrap() |
| 5191 | .build() |
| 5192 | .unwrap(); |
| 5193 | |
| 5194 | let external_filter = col("foo").eq(lit(true)); |
| 5195 | |
| 5196 | // after transformation, because plan is not the same anymore, |
| 5197 | // the parent plan is built again with call to LogicalPlan::with_new_inputs -> with_new_exprs |
| 5198 | let plan = plan |
| 5199 | .transform(|plan| match plan { |
| 5200 | LogicalPlan::TableScan(table) => { |
| 5201 | let filter = Filter::try_new( |
| 5202 | external_filter.clone(), |
| 5203 | Arc::new(LogicalPlan::TableScan(table)), |
| 5204 | ) |
| 5205 | .unwrap(); |
| 5206 | Ok(Transformed::yes(LogicalPlan::Filter(filter))) |
| 5207 | } |
| 5208 | x => Ok(Transformed::no(x)), |
| 5209 | }) |
| 5210 | .data() |
| 5211 | .unwrap(); |
| 5212 | |
| 5213 | let actual = format!("{}", plan.display_indent()); |
| 5214 | assert_snapshot!(actual, @r" |
| 5215 | Explain |
| 5216 | Filter: foo = Boolean(true) |
| 5217 | TableScan: ?table? |
| 5218 | ") |
| 5219 | } |
| 5220 | |
| 5221 | #[test] |
| 5222 | fn test_plan_partial_ord() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…