jayendra13 commented on issue #16054:
URL: https://github.com/apache/datafusion/issues/16054#issuecomment-4032997609
Hi @AndreaBozzo, I've been working on the same issue and took a slightly
different approach — precedence-based parenthesization instead of unconditional
wrapping.
The idea is to only add parentheses when the child operator has lower
precedence than the parent, matching the logic already used by the Display impl
for BinaryExpr (line 621). This
avoids unnecessary parens for same/higher precedence cases, which may help
with the SLT failures you're seeing from optimize_projections.
For example, SELECT 1+2+3:
- Before: Int64(1) + Int64(2) + Int64(3) (already correct, no parens
needed)
- Unconditional: (Int64(1) + Int64(2)) + Int64(3) (unnecessary parens,
changes schema name)
- Precedence-based: Int64(1) + Int64(2) + Int64(3) (unchanged, no schema
mismatch)
My branch is here:
https://github.com/jayendra13/datafusion/tree/fix-schema-parens
Happy to collaborate or consolidate — let me know what you think.
--
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]