apache / datafusion

Apache DataFusion SQL Query Engine
https://datafusion.apache.org/
Apache License 2.0
5.67k stars 1.06k forks source link

Support function signature of any type #7225

Open ZuoTiJia opened 11 months ago

ZuoTiJia commented 11 months ago

Is your feature request related to a problem or challenge?

I want to create a UDF function with type signature like this:

func(a any, b any, c bigint)
func(a any, b any, c bigint, d bigint)

there seems to be no way.

Here is the function signature supported by Postgresql. https://www.postgresql.org/docs/current/extend-type-system.html#EXTEND-TYPES-POLYMORPHIC

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

alamb commented 11 months ago

I think you can implement such a function by declaring it to use TypeSignature::VariadicAny: https://docs.rs/datafusion/latest/datafusion/logical_expr/enum.TypeSignature.html#variant.VariadicAny