Apache DataFusion SQL Query Engine
fix(physical-optimizer): show one-line operator in SanityCheckPlan error (#27208)
Efe Omoregie68808c992ce2
diff --git a/datafusion/physical-optimizer/src/sanity_checker.rs b/datafusion/physical-optimizer/src/sanity_checker.rsindex bdfb70b9bb..65e1920157 100644--- a/datafusion/physical-optimizer/src/sanity_checker.rs+++ b/datafusion/physical-optimizer/src/sanity_checker.rs@@ -29,7 +29,7 @@ use datafusion_physical_plan::execution_plan::{};use datafusion_physical_plan::joins::SymmetricHashJoinExec;use datafusion_physical_plan::{- ChildSatisfactionOptions, ExecutionPlanProperties, get_plan_string,+ ChildSatisfactionOptions, ExecutionPlanProperties, displayable, get_plan_string,};use crate::PhysicalOptimizerRule;@@ -135,8 +135,8 @@ pub fn check_finiteness_requirements(&& input.pipeline_behavior() == EmissionType::Final){plan_err!(- "Cannot execute pipeline breaking queries, operator: {:?}",- input+ "Cannot execute pipeline breaking queries, operator: {}",+ displayable(input).one_line().to_string().trim_end())} else {Ok(())diff --git a/datafusion/sqllogictest/test_files/ddl.slt b/datafusion/sqllogictest/test_files/ddl.sltindex ee0676d055..083223644e 100644--- a/datafusion/sqllogictest/test_files/ddl.slt+++ b/datafusion/sqllogictest/test_files/ddl.slt@@ -1343,3 +1343,26 @@ create database cat;statement okdrop database cat;++##########+# A pipeline-breaking operator on an unbounded input should be reported with+# its EXPLAIN-style one-line form, not the operator's Debug representation.+##########++statement ok+CREATE UNBOUNDED EXTERNAL TABLE ordering_on_unbounded (+ a0 INT, a INT, b INT, c INT, d INT+) STORED AS CSV+LOCATION '../core/tests/data/window_2.csv'+OPTIONS ('format.has_header' 'true');++statement error+SELECT * FROM ordering_on_unbounded ORDER BY d LIMIT 1;+----+DataFusion error: SanityCheckPlan+caused by+Error during planning: Cannot execute pipeline breaking queries, operator: SortExec: TopK(fetch=1), expr=[d@4 ASC NULLS LAST], preserve_partitioning=[false]+++statement ok+DROP TABLE ordering_on_unbounded;