Make cli handle multiple whitespaces#1388
Merged
alamb merged 1 commit intoapache:masterfrom Dec 2, 2021
Merged
Conversation
houqp
reviewed
Dec 2, 2021
| Ok(line) if line.starts_with('\\') => { | ||
| rl.add_history_entry(line.trim_end()); | ||
| if let Ok(cmd) = &line[1..].parse::<Command>() { | ||
| let command = line.split_whitespace().collect::<Vec<_>>().join(" "); |
Member
There was a problem hiding this comment.
Contributor
Author
There was a problem hiding this comment.
The problem I'd like to fix here is not only leading and trailing whitespaces.
Currently, the behavior is like
DataFusion CLI v5.1.0
❯ \quiet true
'\quiet true' is not a valid command
❯ \pset format csv
'\pset format csv' is not a valid command
❯ \pset format csv
Execution error: csv is not a valid format type [possible values: csv, tsv, table, json, ndjson]
Without normalizing whitespaces before parsing commands, every command need to do trim like here.
https://github.com/apache/arrow-datafusion/blob/42f8ab1e44510cea73f9eb2300d28f2fa92ac55a/datafusion-cli/src/functions.rs#L159
Member
|
eventually, we will need to write a proper lexer and parser for pgcli commands :P |
houqp
approved these changes
Dec 2, 2021
alamb
approved these changes
Dec 2, 2021
Contributor
|
Thanks @capkurmagati -- I think this is a small enough fix we can iterate on it if @jimexist has some suggestions as well |
unkloud
pushed a commit
to unkloud/datafusion
that referenced
this pull request
Mar 23, 2025
## Which issue does this PR close? Closes apache#1388 ## Rationale for this change Following up on apache#1369 and apache#1386 ## What changes are included in this PR? Updated the doc ## How are these changes tested?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
The cli cannot handle whitespace like
The PR fixes this issue by removing the consecutive whitespaces.
Closes #.
Rationale for this change
What changes are included in this PR?
Are there any user-facing changes?