apache / apache/datafusion

Support display newline inside error message

Open
#17,218 0 comments 0 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?

If a newline `\n` is included in the error message, and the error is created with the macro like `exec_datafusion_err!(...)`, this newline can not be properly displayed.
Fixing this can help produce more user-friendly (and eye-friendly) error messages.

Reproducer:
1. Include a newline inside error message at https://github.com/apache/datafusion/blob/main/datafusion/physical-plan/src/spill/mod.rs#L307
2. run
```sh
ulimit -n 256
cargo test --test fuzz
```
And the newline will be displayed as `\n` literal:
```sh
---- fuzz_cases::spilling_fuzz_in_memory_constrained_env::test_aggregate_with_high_cardinality_with_limited_memory_and_different_sizes_of_record_batch_and_changing_memory_reservation stdout ----
Error: Execution("(Hint: you may increase the file descriptor limit with shell command 'ulimit -n 4096')\nFailed to create partition file at \"/var/folders/5p/xc3sx0ds1496j0nxb08lmqw40000gn/T/.tmpyGYV81/.tmptuoheV\": Os { code: 24, kind: Uncategorized, message: \"Too many open files\" }")
```

### Describe the solution you'd like

_No response_

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at datafusion/physical-plan/src/spill/mod.rs around line 307 and trace how exec_datafusion_err!(...) formats the error message. Run `ulimit -n 256; cargo test --test fuzz` to reproduce it; done means an embedded newline is displayed as a line break rather than as a literal `\n`.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.