apache / apache/datafusion

Expr formatting missing parentheses

Open
#16,054 13 comments 0 reactions 0 assignees View on GitHub
bug good first issue
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Describe the bug

In datafusion-cli:
```
> select (1+2)*3;
+--------------------------------+
| Int64(1) + Int64(2) * Int64(3) |
+--------------------------------+
| 9 |
+--------------------------------+
```
The expression displayed in the plan is misleading due to the missing parentheses.

### To Reproduce

_No response_

### Expected behavior

Always include parentheses for binary expressions

### Additional context

Maybe we are also missing `()` for other expression types like unary expression

Contributor guide

Open the contributing guide

Research direction

Start in the expression-formatting path used by datafusion-cli and reproduce the shown `select (1+2)*3;` query. Check how binary expressions are rendered in the displayed plan; done means the output preserves parentheses and any affected unary-expression cases are covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.