capkurmagati commented on a change in pull request #1388:
URL: https://github.com/apache/arrow-datafusion/pull/1388#discussion_r761126864



##########
File path: datafusion-cli/src/exec.rs
##########
@@ -90,7 +90,8 @@ pub async fn exec_from_repl(ctx: &mut Context, print_options: 
&PrintOptions) {
         match rl.readline("❯ ") {
             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(" ");

Review 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




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to