alamb commented on code in PR #13255:
URL: https://github.com/apache/datafusion/pull/13255#discussion_r1829810165


##########
datafusion/expr-common/src/signature.rs:
##########
@@ -243,6 +243,27 @@ impl TypeSignature {
             _ => false,
         }
     }
+
+    /// get all possible types for the given `TypeSignature`
+    pub fn get_possible_types(&self) -> Vec<Vec<DataType>> {
+        match self {
+            TypeSignature::Exact(types) => vec![types.clone()],
+            TypeSignature::OneOf(types) => types
+                .iter()
+                .flat_map(|type_sig| type_sig.get_possible_types())
+                .collect(),
+            // TODO: Implement for other types
+            TypeSignature::Uniform(_, _)
+            | TypeSignature::Coercible(_)

Review Comment:
   I think we should file a ticket to track adding the feature (I bet some 
other contributors would enjoy helping out now that you have setup the 
framework)



##########
datafusion/sqllogictest/test_files/information_schema.slt:
##########
@@ -603,3 +610,29 @@ query TTTT
 SHOW CREATE TABLE abc;
 ----
 datafusion public abc CREATE EXTERNAL TABLE abc STORED AS CSV LOCATION 
../../testing/data/csv/aggregate_test_100.csv
+
+# string_agg has different arg_types but same return type. Test avoiding 
duplicate entries for the same function.
+query TTT
+select routine_name, data_type, function_type from information_schema.routines 
where routine_name = 'string_agg';
+----
+string_agg LargeUtf8 AGGREGATE
+
+# test every function type are included in the result
+query TTTTTTTBTTT rowsort
+select * from information_schema.routines where routine_name = 'date_trunc' OR 
routine_name = 'string_agg' OR routine_name = 'rank';
+----
+datafusion public date_trunc datafusion public date_trunc FUNCTION true 
Timestamp(Microsecond, None) SCALAR Truncates a timestamp value to a specified 
precision.

Review Comment:
   I agree -- makes sense 👍 



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