xudong963 commented on code in PR #16726: URL: https://github.com/apache/datafusion/pull/16726#discussion_r2204414163
########## datafusion/physical-optimizer/src/output_requirements.rs: ########## @@ -138,10 +138,36 @@ impl DisplayAs for OutputRequirementExec { ) -> std::fmt::Result { match t { DisplayFormatType::Default | DisplayFormatType::Verbose => { - write!(f, "OutputRequirementExec") + let order_cols = if let Some(reqs) = &self.order_requirement { + let (lexes, _) = reqs.clone().into_alternatives(); + if let Some(lex) = lexes.first() { + let pairs: Vec<String> = lex + .iter() + .map(|req| { + if let Some(options) = &req.options { + let direction = + if options.descending { "desc" } else { "asc" }; + format!("({}, {direction})", req.expr) + } else { + format!("({}, unspecified)", req.expr) + } + }) + .collect(); + format!("[{}]", pairs.join(", ")) + } else { + "[]".to_string() + } + } else { + "[]".to_string() + }; + + write!( + f, + "OutputRequirementExec: order_by={}, dist_by={}", + order_cols, self.dist_requirement + ) Review Comment: ```suggestion let order_cols = self.order_requirement.as_ref() .and_then(|reqs| reqs.into_alternatives().0.first()) .map(|lex| { let pairs: Vec<String> = lex.iter() .map(|req| { let direction = req.options .as_ref() .map(|opt| if opt.descending { "desc" } else { "asc" }) .unwrap_or("unspecified"); format!("({}, {direction})", req.expr) }) .collect(); format!("[{}]", pairs.join(", ")) }) .unwrap_or_else(|| "[]".to_string()); write!( f, "OutputRequirementExec: order_by={}, dist_by={}", order_cols, self.dist_requirement ) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org