Coercible signature: how to specify some inputs should have exact same type?
- Lingua principale
- Rust
- Stelle
- 9.3k
- Fork
- 2.4k
- Merge medio
- 3g 11h
- PR unite (30g)
- 360
Descrizione
### Is your feature request related to a problem or challenge?
Looking at `btrim` for example:
https://github.com/apache/datafusion/blob/f27e50c13647efa5292d5ef5b1e4ed6af3015962/datafusion/functions/src/string/btrim.rs#L82-L93
It specifies it accepts 2 string input types. However the planner doesn't coerce them to a common type, leaving it up to the UDF to handle casting to a common type for simplicity (otherwise get explosion of string types to handle):
https://github.com/apache/datafusion/blob/f27e50c13647efa5292d5ef5b1e4ed6af3015962/datafusion/functions/src/string/btrim.rs#L32-L43
### Describe the solution you'd like
Some way in the coercible signature API to specify when inputs should have same type. We previously could do this via:
```rust
TypeSignature::Uniform(2, vec![Utf8, Utf8View, LargeUtf8])
TypeSignature::Exact(vec![Utf8, Utf8]) // and other variants
TypeSignature::String(2)
```
So if we want to still try move toward coercible API, it would be good to support this somehow otherwise its very much less ergonomic for UDFs to handle this logic themselves.
### Describe alternatives you've considered
_No response_
### Additional context
_No response_
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.