Explain plans show __common_expr_ instead of actual values
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
### Describe the bug
Trying to debug another bug and I found that `explain` is broken in two ways:
1. It's replacing the actual expressions with `__common_expr_ ` which seems like an optimization but that should not preclude seeing the values in the output.
2. explain verbose uses the tree format (as opposed to the line format as claimed in the documentation), is verbose being ignored altogether?
### To Reproduce
```sql
COPY (
SELECT arrow_cast('2025-01-01T00:00:00Z'::timestamptz, 'Timestamp(Microsecond, Some("UTC"))') AS start_timestamp
)
TO 'test.parquet'
STORED AS PARQUET;
CREATE EXTERNAL TABLE test STORED AS PARQUET LOCATION 'test.parquet';
explain verbose
select start_timestamp from test where start_timestamp::time between arrow_cast('20:04:13', 'Time64(Nanosecond)') and arrow_cast('20:08:13', 'Time64(Nanosecond)');
```
```
+---------------+-------------------------------+
| plan_type | plan |
+---------------+-------------------------------+
| physical_plan | ┌───────────────────────────┐ |
| | │ CoalesceBatchesExec │ |
| | │ -------------------- │ |
| | │ target_batch_size: │ |
| | │ 8192 │ |
| | └─────────────┬─────────────┘ |
| | ┌─────────────┴─────────────┐ |
| | │ FilterExec │ |
| | │ -------------------- │ |
| | │ predicate: │ |
| | │ __common_expr_3 >= │ |
| | │ 72253000000000 │ |
| | │ AND __common_expr_3 <= │ |
| | │ 72493000000000 │ |
| | └─────────────┬─────────────┘ |
| | ┌─────────────┴─────────────┐ |
| | │ ProjectionExec │ |
| | │ -------------------- │ |
| | │ __common_expr_3: │ |
| | │ CAST(start_timestamp AS │ |
| | │ Time64(Nanosecond)) │ |
| | │ │ |
| | │ start_timestamp: │ |
| | │ start_timestamp │ |
| | └─────────────┬─────────────┘ |
| | ┌─────────────┴─────────────┐ |
| | │ DataSourceExec │ |
| | │ -------------------- │ |
| | │ files: 1 │ |
| | │ format: parquet │ |
| | └───────────────────────────┘ |
| | |
+---------------+-------------------------------+
```
### Expected behavior
_No response_
### Additional context
_No response_
Contributor guide
Research direction
Run the supplied SQL reproduction first, then trace the explain entry point and plan-display path responsible for expression aliases and verbose formatting. Done means the output preserves the actual expressions instead of opaque __common_expr_ names and verbose output matches the documented line format.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100