bubulalabu commented on code in PR #18019:
URL: https://github.com/apache/datafusion/pull/18019#discussion_r2443299646


##########
datafusion/expr-common/src/signature.rs:
##########
@@ -996,13 +1159,119 @@ impl Signature {
                 },
             ),
             volatility,
+            parameter_names: None,
         }
     }
 
     /// Specialized [Signature] for ArrayEmpty and similar functions.
     pub fn array(volatility: Volatility) -> Self {
         Signature::arrays(1, Some(ListCoercion::FixedSizedListToList), 
volatility)
     }
+
+    /// Add parameter names to this signature, enabling named argument 
notation.
+    ///
+    /// # Example
+    /// ```
+    /// # use datafusion_expr_common::signature::{Signature, Volatility};
+    /// # use arrow::datatypes::DataType;
+    /// let sig = Signature::exact(vec![DataType::Int32, DataType::Utf8], 
Volatility::Immutable)
+    ///     .with_parameter_names(vec!["count".to_string(), 
"name".to_string()]);
+    /// ```
+    ///
+    /// # Errors
+    /// Returns an error if the number of parameter names doesn't match the 
signature's arity.
+    /// For signatures with variable arity (e.g., `Variadic`, `VariadicAny`), 
parameter names
+    /// cannot be specified.
+    pub fn with_parameter_names(
+        mut self,
+        names: Vec<String>,
+    ) -> datafusion_common::Result<Self> {
+        // Validate that the number of names matches the signature
+        self.validate_parameter_names(&names)?;
+        self.parameter_names = Some(names);
+        Ok(self)
+    }
+
+    /// Validate that parameter names are compatible with this signature
+    fn validate_parameter_names(
+        &self,
+        names: &[String],
+    ) -> datafusion_common::Result<()> {
+        // Get expected argument count from the type signature
+        let expected_count = match &self.type_signature {

Review Comment:
   done



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