apache / apache/datafusion

Support autocomplet for datafusion-cli

Open
#8,783 2 comments 0 reactions 0 assignees View on GitHub
enhancement help wanted
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?

Currently, the DataFusion CLI lacks autocompletion support, which can be a hindrance to users trying to efficiently navigate and execute commands. Autocompletion is a standard feature in modern CLIs that significantly improves user productivity by suggesting and completing commands, options, and arguments as users type.

### Describe the solution you'd like

extend current `Completer`
``` rust
impl Completer for CliHelper {
type Candidate = Pair;

fn complete(
&self,
line: &str,
pos: usize,
ctx: &Context<'_>,
) -> std::result::Result<(usize, Vec), ReadlineError> {
if is_open_quote_for_location(line, pos) {
self.completer.complete(line, pos, ctx)
} else {
Ok((0, Vec::with_capacity(0)))
}
}
}
```
then search the most possible command based on input (maybe build up Trie index for it?)

### Describe alternatives you've considered

_No response_

### Additional context

[#1251](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)

Contributor guide

Open the contributing guide

Research direction

Start in datafusion-cli by locating the existing CliHelper implementation of the rustyline Completer trait and its current completion behavior. Trace how command input is represented, then define completion behavior for commands, options, and arguments; done means relevant CLI inputs produce useful suggestions, with coverage for the supported completion cases.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.