comphead commented on code in PR #7972:
URL: https://github.com/apache/arrow-datafusion/pull/7972#discussion_r1375508934


##########
datafusion/core/src/execution/context/mod.rs:
##########
@@ -849,6 +849,33 @@ impl SessionContext {
         let table_paths = table_paths.to_urls()?;
         let session_config = self.copied_config();
         let listing_options = options.to_listing_options(&session_config);
+
+        let option_extention = listing_options.file_extension.clone();
+        let filename = table_paths[0].prefix().filename();
+        let extention = if let Some(filename) = filename {
+            let parts: Vec<&str> = filename.split('.').collect();
+
+            if parts.len() > 1 {
+                parts[1..].join(".")
+            } else {
+                "".to_owned()
+            }
+        } else {
+            "".to_owned()
+        };
+        // some the file extension might be started with "." and some not
+        let extention_alternative = ".".to_string() + extention.as_str();
+
+        if option_extention != extention
+            && option_extention != extention_alternative
+            && !extention.is_empty()
+        {
+            return Err(DataFusionError::Execution(format!(

Review Comment:
   please replace with `exec_err!` macros



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