Jah-yee opened a new pull request, #21787:
URL: https://github.com/apache/datafusion/pull/21787

   Good day,
   
   This PR fixes apache/datafusion#16054 - "Expr formatting missing 
parentheses".
   
   ## Problem
   The `human_display()` method for `BinaryExpr` was not adding parentheses to 
correctly reflect operator precedence. For example, `(1+2)*3` was displayed as 
`1 + 2 * 3` instead of `(1 + 2) * 3`.
   
   ## Solution
   Added a `write_child` helper function that checks operator precedence and 
wraps child `BinaryExpr`s in parentheses when the child has lower precedence 
than the parent. This matches the behavior in the `BinaryExpr` `Display` impl.
   
   ## Changes
   - Modified `SqlDisplay::write` for `Expr::BinaryExpr` to use 
precedence-aware child formatting
   - Added `test_human_display_binary_expr_parens` test to verify the fix
   
   ## Test results
   `cargo test -p datafusion-expr test_human_display_binary_expr_parens` passes 
✅
   
   ## Verification
   - Commit author: Jah-yee <[email protected]> ✅
   - All existing tests pass (ran full test suite for datafusion-expr)
   
   Thank you for your attention. If there are any issues or suggestions, please 
leave a comment and I will address them promptly.
   
   Warmly, Jah-yee


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to