MCPcopy Create free account
hub / github.com/apache/datafusion / test_transform_explain

Function test_transform_explain

datafusion/expr/src/logical_plan/plan.rs:5181–5219  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 13

newFunction · 0.85
table_scanFunction · 0.85
noneFunction · 0.85
TableScanClass · 0.85
FilterClass · 0.70
colFunction · 0.50
litFunction · 0.50
buildMethod · 0.45
explainMethod · 0.45
eqMethod · 0.45
dataMethod · 0.45
transformMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…