apache / apache/datafusion

Unified Function `Signature` type coercion handling for `Nulls`

Open
#12,698 5 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Is your feature request related to a problem or challenge?

The code in https://github.com/apache/datafusion/pull/12308 from @mesejo added explicit `DataType::Null` data type handling for type coercion for certain functions

However, this may have introduced a regression for handling Dictionary types https://github.com/apache/datafusion/issues/12670

### Describe the solution you'd like

I would like the "normal" function signature resolution to handle Null coercion rather than requiring functions to provide a custom coerce method (as was done in https://github.com/apache/datafusion/pull/12308)

Comments from https://github.com/apache/datafusion/issues/12670#issuecomment-2385333981

### Describe alternatives you've considered

Ideally I think the coercion logic should be able to substitute `Null` for any data type passed in

So given a signature like
```rust
Exact(vec![Utf8View, Utf8View]),
```

I would expect the coercion logic to be able to handle inputs like the following (by casting `Null` to Utf8View)

```rust
(Null, Null)
(Null, Utf8View)
(Utf8View, Null)
(Utf8View, Utf8View)
```

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing normal function signature resolution and compare it with the custom coercion path introduced by PR #12308, including the Dictionary regression in issue #12670. Validate the listed Exact([Utf8View, Utf8View]) combinations and ensure Null is coerced for every position without regressing Dictionary handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.