-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Is your feature request related to a problem or challenge?
Part of #9494
In #10573 @goldmedal made expressions from the DataFusion SQL unparser (aka expr --> String) nicer. However there are still certain cases where the rendering will err on the side of explicitness rather than (human readability()
For examoke, it puts in quotes to make the order of operations explicit -- so instead of a < 5 AND b < 10
it would render ("a" < 5) AND ("b" < 10)
The current unparser is conservative and likely works well for when generating SQL for consumptions by other database systems. It could be nicer for generating SQL to read by humans
Describe the solution you'd like
If we want to make the generated SQL easier to read by humans / more succinct, these steps will have to be made "smarter".
Describe alternatives you've considered
-
We'll have to add in the math rules (precidence) to avoid unneeded parentheses. These rules typically vary subtly between dialects.
-
We could simply not do this item as well as it is likely hard to get right and maybe extra parens aren't all that bad 🤔
Additional context
No response