apache / apache/datafusion

Improve consistency of expression names

Open
#3,330 1 comment 2 reactions 0 assignees View on GitHub
enhancement
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.**
We have many different ways to create names from expressions with duplicated and sometimes inconsistent code.

Logical Expression:
- Display trait
- Debug trait
- `Expr.name()` method (wrapper for `create_name` function)
- `ExprIdentifierVisitor::desc_expr`

Physical Expression:
- Display trait
- Debug trait
- `create_physical_name` function

One example of confusion is that queries sometimes result in field names containing `Divide` and sometimes `/`. For example:

- `decimal_simple.c1 / CAST(Float64(0.00001) AS Decimal128(5, 5))` uses `/`
- `CAST(decimal_simple.c1 AS Decimal128(30, 19)) Divide CAST(decimal_simple.c5 AS Decimal128(30, 19))` uses `Divide`

**Describe the solution you'd like**
Make names more consistent and avoid duplicate code

**Describe alternatives you've considered**
None

**Additional context**
None

Contributor guide

Open the contributing guide

Research direction

Start by tracing the naming paths listed in the issue: the Display and Debug implementations, Expr.name(), create_name, ExprIdentifierVisitor::desc_expr, and create_physical_name. Compare their handling of operators such as Divide and `/`; done means expression names are consistent and the duplicated naming logic is reduced.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
data-engineering
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.