Skip to content

Apache DataFusion SQL Query Engine

allow datafusion cli to take -- comments (#296)

Jiayu Liua00f410e0c95
diff --git a/datafusion-cli/src/main.rs b/datafusion-cli/src/main.rs
index 05c6766cee..f15c1d8e4a 100644
--- a/datafusion-cli/src/main.rs
+++ b/datafusion-cli/src/main.rs
@@ -114,6 +114,9 @@ async fn exec_from_lines(
for line in reader.lines() {
match line {
+ Ok(line) if line.starts_with("--") => {
+ continue;
+ }
Ok(line) => {
let line = line.trim_end();
query.push_str(line);
@@ -124,7 +127,7 @@ async fn exec_from_lines(
}
query = "".to_owned();
} else {
- query.push(' ');
+ query.push('\n');
}
}
_ => {
@@ -154,6 +157,9 @@ async fn exec_from_repl(execution_config: ExecutionConfig, print_format: PrintFo
Ok(ref line) if is_exit_command(line) && query.is_empty() => {
break;
}
+ Ok(ref line) if line.starts_with("--") => {
+ continue;
+ }
Ok(ref line) if line.trim_end().ends_with(';') => {
query.push_str(line.trim_end());
rl.add_history_entry(query.clone());
@@ -165,7 +171,7 @@ async fn exec_from_repl(execution_config: ExecutionConfig, print_format: PrintFo
}
Ok(ref line) => {
query.push_str(line);
- query.push(' ');
+ query.push('\n');
}
Err(_) => {
break;