tinfoil-knight commented on code in PR #9594:
URL: https://github.com/apache/arrow-datafusion/pull/9594#discussion_r1523729912


##########
datafusion/sql/src/statement.rs:
##########
@@ -855,6 +855,31 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
         let file_type = try_infer_file_type(&mut options, &statement.target)?;
         let partition_by = take_partition_by(&mut options);
 
+        let rename_keys = |options: HashMap<String, String>| {
+            options
+                .into_iter()
+                .map(|(k, v)| {
+                    // If config does not belong to any namespace, assume it is
+                    // a legacy option and apply file_type namespace for 
backwards
+                    // compatibility.
+                    if !k.contains('.') {
+                        let new_key = format!("{}.{}", file_type, k);
+                        (new_key, v)
+                    } else {
+                        (k, v)
+                    }
+                })
+                .collect()
+        };
+
+        // Renames un-prefixed keys to support legacy format specific options
+        let options = match &file_type {
+            FileType::CSV | FileType::JSON => rename_keys(options),
+            #[cfg(feature = "parquet")]
+            FileType::PARQUET => rename_keys(options),

Review Comment:
   @devinjdangelo 
   
   Since `FileType::PARQUET` isn't accessible without the feature enabled, I 
added the `cfg` macro but I'm getting:
   `code is inactive due to #[cfg] directives: feature = "parquet" is disabled` 
from rust-analyzer.
   
   I haven't been able to figure out why. I checked all other instances of 
`#[cfg(feature = "parquet")]` but didn't get the disabled warning anywhere else.



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