This is an automated email from the ASF dual-hosted git repository.

mneumann pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 7561cbc057 Minor: Update Sanity Checker Error Messages (#12333)
7561cbc057 is described below

commit 7561cbc057ddecea220cc052011d9a8f5e2eef02
Author: Berkay Şahin <[email protected]>
AuthorDate: Thu Sep 5 13:58:44 2024 +0300

    Minor: Update Sanity Checker Error Messages (#12333)
    
    * Update sanity_checker.rs
    
    * Update datafusion/core/src/physical_optimizer/sanity_checker.rs
    
    Co-authored-by: Marco Neumann <[email protected]>
    
    ---------
    
    Co-authored-by: Marco Neumann <[email protected]>
---
 .../core/src/physical_optimizer/sanity_checker.rs  | 30 ++++++++++++----------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/datafusion/core/src/physical_optimizer/sanity_checker.rs 
b/datafusion/core/src/physical_optimizer/sanity_checker.rs
index bd80d31224..e392105fbc 100644
--- a/datafusion/core/src/physical_optimizer/sanity_checker.rs
+++ b/datafusion/core/src/physical_optimizer/sanity_checker.rs
@@ -120,32 +120,36 @@ pub fn check_plan_sanity(
 ) -> Result<Transformed<Arc<dyn ExecutionPlan>>> {
     check_finiteness_requirements(plan.clone(), optimizer_options)?;
 
-    for (child, child_sort_req, child_dist_req) in izip!(
-        plan.children().iter(),
+    for ((idx, child), sort_req, dist_req) in izip!(
+        plan.children().iter().enumerate(),
         plan.required_input_ordering().iter(),
         plan.required_input_distribution().iter()
     ) {
         let child_eq_props = child.equivalence_properties();
-        if let Some(child_sort_req) = child_sort_req {
-            if !child_eq_props.ordering_satisfy_requirement(child_sort_req) {
-                let child_plan_str = get_plan_string(child);
+        if let Some(sort_req) = sort_req {
+            if !child_eq_props.ordering_satisfy_requirement(sort_req) {
+                let plan_str = get_plan_string(&plan);
                 return plan_err!(
-                    "Child: {:?} does not satisfy parent order requirements: 
{:?}",
-                    child_plan_str,
-                    child_sort_req
+                    "Plan: {:?} does not satisfy order requirements: {:?}. 
Child-{} order: {:?}",
+                    plan_str,
+                    sort_req,
+                    idx,
+                    child_eq_props.oeq_class
                 );
             }
         }
 
         if !child
             .output_partitioning()
-            .satisfy(child_dist_req, child_eq_props)
+            .satisfy(dist_req, child_eq_props)
         {
-            let child_plan_str = get_plan_string(child);
+            let plan_str = get_plan_string(&plan);
             return plan_err!(
-                "Child: {:?} does not satisfy parent distribution 
requirements: {:?}",
-                child_plan_str,
-                child_dist_req
+                "Plan: {:?} does not satisfy distribution requirements: {:?}. 
Child-{} output partitioning: {:?}",
+                plan_str,
+                dist_req,
+                idx,
+                child.output_partitioning()
             );
         }
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to