You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/05/07 21:27:14 UTC

[GitHub] [arrow-datafusion] alamb commented on a change in pull request #284: add param validation for datafusion-cli

alamb commented on a change in pull request #284:
URL: https://github.com/apache/arrow-datafusion/pull/284#discussion_r628539559



##########
File path: datafusion-cli/src/main.rs
##########
@@ -100,6 +102,21 @@ pub async fn main() {
     rl.save_history(".history").ok();
 }
 
+fn is_valid_data_dir(dir: String) -> std::result::Result<(), String> {
+    if Path::new(&dir).is_dir() {
+        Ok(())
+    } else {
+        Err(format!("Invalid data directory “{}”", dir))
+    }
+}
+
+fn is_valid_batch_size(size: String) -> std::result::Result<(), String> {
+    match size.parse::<usize>() {
+        Ok(size) if size > 0 => Ok(()),
+        _ => Err(format!("Invalid batch size “{}”", size)),

Review comment:
       ```suggestion
           _ => Err(format!("Invalid batch size '{}'", size)),
   ```

##########
File path: datafusion-cli/src/main.rs
##########
@@ -100,6 +102,21 @@ pub async fn main() {
     rl.save_history(".history").ok();
 }
 
+fn is_valid_data_dir(dir: String) -> std::result::Result<(), String> {
+    if Path::new(&dir).is_dir() {
+        Ok(())
+    } else {
+        Err(format!("Invalid data directory “{}”", dir))

Review comment:
       ```suggestion
           Err(format!("Invalid data directory '{}'", dir))
   ```
   
   The `'` quote is used in much of the rest of DataFusion so it might be useful to use that here, rather than smart quotes. 




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org