beautify default column names
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
Currently, DataFusion creates column names by https://github.com/apache/arrow-datafusion/blob/7be0e268a69ffecbf06823c98ca572733dddb29e/datafusion/src/physical_plan/planner.rs#L91.
The approach has two existing problems:
1. result in potential bugs, such as https://github.com/apache/arrow-datafusion/issues/1818.
2. Makes the printed table unattractive and may be very wide, such as
```sql
❯ select COALESCE(null, null, null, null);
+-------------------------------------------------------+
| coalesce(Utf8(NULL),Utf8(NULL),Utf8(NULL),Utf8(NULL)) |
+-------------------------------------------------------+
| |
+-------------------------------------------------------+
1 row in set. Query took 0.002 seconds.
```
**Describe the solution you'd like**
1. Simplify default column names by modifying https://github.com/apache/arrow-datafusion/blob/7be0e268a69ffecbf06823c98ca572733dddb29e/datafusion/src/physical_plan/planner.rs#L91.
2. Directly define a default column name, such as `?column?` in postgres:
```sql
postgres=# select 1, 2;
?column? | ?column?
----------+----------
1 | 2
(1 row)
```
Contributor guide
Research direction
Start in datafusion/src/physical_plan/planner.rs at the referenced column-name logic and review the issue's SQL examples, including the PostgreSQL ?column? behavior. Define simplified default names for expressions such as COALESCE and select 1, 2, then verify that the displayed results no longer use overly wide expression text.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100