datafusion-cli: allow configuring the location of the interactive shell's history file
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
## Describe the bug
`datafusion-cli`'s interactive REPL hardcodes its rustyline history file as the relative path `.history` (see `exec_from_repl` in [`datafusion-cli/src/exec.rs`](https://github.com/apache/datafusion/blob/main/datafusion-cli/src/exec.rs)):
```rust
rl.load_history(".history").ok();
...
rl.save_history(".history")
```
Because the path is relative, the history file is created in whatever directory the CLI happens to be launched from, so every working directory silently accumulates its own hidden `.history` file, and there is no way to point it somewhere else (e.g. a fixed location shared across sessions, or a location outside the current directory when it's read-only).
## To Reproduce
Run `datafusion-cli` from two different directories and note that each gets its own independent `.history` file, with no way to override the location.
## Expected behavior
Allow the history file location to be configured, e.g. via a `--history-file` CLI flag (and/or an environment variable), while keeping the current `.history` relative-path behavior as the default so existing workflows are unaffected.
## Additional context
I have a small PR ready that adds a `--history-file ` flag and a `DATAFUSION_HISTORY_FILE` environment variable (flag takes precedence), without changing the existing default.
Contributor guide
Research direction
Start in datafusion-cli/src/exec.rs at exec_from_repl, then trace the datafusion-cli option configuration entry point. Verify the history path can be configured through --history-file and DATAFUSION_HISTORY_FILE, that the flag takes precedence, and that the default remains .history.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100