r1b commented on code in PR #18450:
URL: https://github.com/apache/datafusion/pull/18450#discussion_r2484974334


##########
datafusion/sql/src/statement.rs:
##########
@@ -1233,9 +1251,23 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
                 //
                 let arg_types = args.as_ref().map(|arg| {
                     arg.iter()
-                        .map(|t| Arc::new(Field::new("", t.data_type.clone(), 
true)))
+                        .map(|t| {
+                            let name = match t.name.clone() {
+                                Some(name) => name.value,
+                                None => "".to_string(),
+                            };
+                            Arc::new(Field::new(name, t.data_type.clone(), 
true))
+                        })
                         .collect::<Vec<_>>()
                 });
+                // Validate parameter style
+                if let Some(ref fields) = arg_types {
+                    let count_positional =
+                        fields.iter().filter(|f| f.name() == "").count();
+                    if !(count_positional == 0 || count_positional == 
fields.len()) {
+                        return plan_err!("All function arguments must use 
either named or positional style.");
+                    }
+                }

Review Comment:
   **note** I'm not sure this is actually necessary, but it made it easier to 
reason about the changes. If we think this is valuable I can look at relaxing 
this constraint.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to